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 onserver2.When I run my application fromserver1 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 inServer1,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 toserver1,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.
thanks,
xyz789
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.
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?
thanks,
xyz789
|||Hi xyz789,
Generally speaking, you will receive this "Not associated with a trusted SQL Server connection"message when the SQL Serversecurity authentication is set toWindows onlyunder these 3 cases:
1.You are trying to connect to a SQL Server database with a SQL Server login.
2.You are trying to connect to a SQL Server 2000 Desktop Engine (also known as MSDE 2000) database that is installed on a Microsoft Windows 98-based computer by using a trusted SQL Server connection.
3.You are trying to connect to a SQL Server database from a Windows account that does not have sufficient permissions to connect to the server.
|||Thank you, that solved the problem.
xyz789