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

F

Frederik

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

(e-mail address removed)
Frederik
 
K

Ken Cox [Microsoft MVP]

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/dotnet/adonet/Data_Providers.htm#SQLClientManagedProvider

See also:

http://support.microsoft.com/default.aspx?scid=kb;en-us;316989

Ken
Toronto


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

(e-mail address removed)
Frederik
 
J

Jeff

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top