Tuesday, March 27, 2012

Login failed for user (null). Reason: Not associated with a trusted SQL Server connection

Hi,

First sorry for my english I'm french.

I developped a web app that work good under XPDEVSERVER machine (iis5) and SqlServerDevelopper Edition.

I get problem when I moved this app to an other web server (IIS5.0) win2000. Actualy, I only have problem to connect with the Database that she still hosted on the the XPDEVSERVER mahcine . I get this error msg when I ask a aspx page that is connected to the database:

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection

Here is my connection string :

strConn = "data source=DEVSERVER;Provider=SQLOLEDB; initial catalog=pickup;integrated security=SSPI;persist security info=False;workstation id=DEVSERVER;packet size=4096"

I also tried to use a local Sql Server acount with pwd and i got the same error message.data source=DEVSERVER;User ID=SqlUser;Password=SqlUserPwd

I also tried data source=DEVSERVER\aspnet

* I haven't find any sample or solution that show how to connect ASPX page to a remote SQL Server that.
It is suppose to be an frequently used architeture no?

* I added the ASPNET user on the database.

Thanks for your help

aspnetdev@dotnet.itags.org.hotmail.com
FrederikSalut Frederik,

If you're connecting to to a remote SQL server (via IP address), try this:

oSQLConn.ConnectionString = "Network Library=DBMSSOCN;" & _
"Data Source=xxx.xxx.xxx.xxx,1433;" & _
"Initial Catalog=mySQLServerDBName;" & _
"User ID=myUsername;" & _
"Password=myPassword"
Where:
- "Network Library=DBMSSOCN" tells SqlConnection to use TCP/IP (KB Q238949)
- xxx.xxx.xxx.xxx is an IP address.
- 1433 is the default port number for SQL Server. (KB Q269882 and Q287932)
- You can also add "Encrypt=yes" for encryption

There are other connection strings here:

http://www.able-consulting.com/dotn...ManagedProvider

See also:

http://support.microsoft.com/defaul...kb;en-us;316989

Ken
Toronto

"Frederik" <aspnetdev@.hotmail.com> wrote in message
news:eppV8s5sDHA.2360@.TK2MSFTNGP10.phx.gbl...
Hi,

First sorry for my english I'm french.

I developped a web app that work good under XPDEVSERVER machine (iis5) and
SqlServerDevelopper Edition.

I get problem when I moved this app to an other web server (IIS5.0) win2000.
Actualy, I only have problem to connect with the Database that she still
hosted on the the XPDEVSERVER mahcine . I get this error msg when I ask a
aspx page that is connected to the database:

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection

Here is my connection string :

strConn = "data source=DEVSERVER;Provider=SQLOLEDB; initial
catalog=pickup;integrated security=SSPI;persist security
info=False;workstation id=DEVSERVER;packet size=4096"

I also tried to use a local Sql Server acount with pwd and i got the same
error message.data source=DEVSERVER;User ID=SqlUser;Password=SqlUserPwd

I also tried data source=DEVSERVER\aspnet

* I haven't find any sample or solution that show how to connect ASPX page
to a remote SQL Server that.
It is suppose to be an frequently used architeture no?

* I added the ASPNET user on the database.

Thanks for your help

aspnetdev@.hotmail.com
Frederik
I believe that the reason for the problem in the first place is the
"integrated security=SSPI" in the connection string. This tells SQL to use
domain credentials to connect you to the database; it ignores any user and
password settings you pass. I would hazard to guess that your web box and
your database are not in the same domain - in this case, SQL can't get the
credentials and you get the null user message. At least this is when I've
seen it.

Jeff

"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
news:Ob1ruk8sDHA.2132@.TK2MSFTNGP10.phx.gbl...
> Salut Frederik,
> If you're connecting to to a remote SQL server (via IP address), try this:
> oSQLConn.ConnectionString = "Network Library=DBMSSOCN;" & _
> "Data Source=xxx.xxx.xxx.xxx,1433;" & _
> "Initial Catalog=mySQLServerDBName;" & _
> "User ID=myUsername;" & _
> "Password=myPassword"
> Where:
> - "Network Library=DBMSSOCN" tells SqlConnection to use TCP/IP (KB
Q238949)
> - xxx.xxx.xxx.xxx is an IP address.
> - 1433 is the default port number for SQL Server. (KB Q269882 and
Q287932)
> - You can also add "Encrypt=yes" for encryption
> There are other connection strings here:
>
http://www.able-consulting.com/dotn...ManagedProvider
> See also:
> http://support.microsoft.com/defaul...kb;en-us;316989
> Ken
> Toronto
>
> "Frederik" <aspnetdev@.hotmail.com> wrote in message
> news:eppV8s5sDHA.2360@.TK2MSFTNGP10.phx.gbl...
> Hi,
> First sorry for my english I'm french.
> I developped a web app that work good under XPDEVSERVER machine (iis5) and
> SqlServerDevelopper Edition.
> I get problem when I moved this app to an other web server (IIS5.0)
win2000.
> Actualy, I only have problem to connect with the Database that she still
> hosted on the the XPDEVSERVER mahcine . I get this error msg when I ask a
> aspx page that is connected to the database:
> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> Server connection
> Here is my connection string :
> strConn = "data source=DEVSERVER;Provider=SQLOLEDB; initial
> catalog=pickup;integrated security=SSPI;persist security
> info=False;workstation id=DEVSERVER;packet size=4096"
> I also tried to use a local Sql Server acount with pwd and i got the same
> error message.data source=DEVSERVER;User ID=SqlUser;Password=SqlUserPwd
> I also tried data source=DEVSERVER\aspnet
> * I haven't find any sample or solution that show how to connect ASPX page
> to a remote SQL Server that.
> It is suppose to be an frequently used architeture no?
>
> * I added the ASPNET user on the database.
>
> Thanks for your help
> aspnetdev@.hotmail.com
> Frederik

0 comments:

Post a Comment