Last post Aug 03, 2007 10:37 AM by xyz789
Aug 01, 2007 11:36 AM|xyz789|LINK
I have an issue dealing with connectivity between the client and Sql Server Services or Sql Authentication. I keep receiving this type of error message:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
I am sure my connection string is correct within my web config file, I have something like this:
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
The reason why I think the connection string is correct is because I have a server where my asp.net application is stored and used, this server is called server1. Server1 is connected to MS-SQL server that is installed and used on
server2. When I run my application from server1 everything is perfect, nothing goes wrong, but when I run the application from my client or local machine I get the error message saying not associated with a trusted site.
Now I have the web config set to <identity impersonate="true"> that will allow windows Authentication, and I set the permissions within the database to use NT AUTHORITY \ NETWORK SERVICE as a user, plus my own network credentials are set within user on the
database, just so I could troubleshoot the problem. But I still get the error message not associated with a trusted site.
Just to recap my problem, I can see the data when I run the application in
Server1, but I can't see the data when I run the application from my local machine.
http://server1/MyApplication.aspx <-- this is an example of the url that I enter on my local machine to acces the application. Plus I have full acces to
server1, and other application are running just fine from this server.
I am using visual studio 2005, but using sql 2000, with the latest service pack for windows XP pro.
.NET SQL Server 2000
SQL 2000 Server Connection
SQL 2000 Server
ASP .NET 2
Aug 01, 2007 11:48 AM|triggered|LINK
Your connection string is missing your username and password for SqlAuthentication. The reason why it works on server is because its using windows authentication.
It sounds like this is what you intended though. If so, you need to specifiy which user to impersonate by setting the network credentials in your code behind.
Aug 01, 2007 02:26 PM|xyz789|LINK
I am still a little lost, I thought the <identity impersonate=true> would pick up any user credentials if they were accessing the application on the network. I am not understanding how you check network credentials in the code behind? Do you have an example
that you could share with me?
Aug 03, 2007 03:54 AM|Bo Chen – MSFT|LINK
Generally speaking, you will receive this "Not associated with a trusted SQL Server connection"
message when the SQL Serversecurity authentication is set to
Windows only under these 3 cases:
And in your case, i think most probably, it's the 3rd case.
To solve this problem, you can try the following 2 ways:
Click the Database Access tab, set the appropriate permissions for the client, and then click
(ii)Try to use SQL server Authentication instead. In the New Login Dialog box, Select Sql Server Authentication and input a login name/password. But remember to change your connection string accordingly.
There is one KB article addressing your problem, see:
Hope my suggestion helps
Aug 03, 2007 10:37 AM|xyz789|LINK
Thank you, that solved the problem.