Error accessing SQL Server:

  • Thread starter news.microsoft.com
  • Start date
N

news.microsoft.com

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

I guess I get this because, my pages are hosted on WinXP IIS and the sql
server is on Win2k3.



So my aspnet a/c doesn't match with the Win2k3's aspnet a/c.



But what is the solution for this?



Thanks
 
K

Kevin Spencer

Well, let me explain how SQL Server handles security first, so the next time
this issue comes up in some different fashion, you will know how to deal
with it.

SQL Server has 2 security modes: SQL Server only, and Mixed SQL Server and
Windows authentication. that is, SQL Server has its own built-in
authentication system, but it can also integrate with the local machine or
Active Directory to use Windows authentication. SQL Server's authentication
model is very similar to Windows, in that it has users and groups, and
specific levels of permissions. When SQL Server uses SQL Server
authentication, the Connection String must contain the user name and
password for that user to authenticate. In Windows authentication this is
not necessary, as the user's Windows credentials are passed in the message
itself. When using Windows authentication, the user that is requesting
access to the SQL Server must be a domain user account in Active Directory
(or the local machine, if the machine is not part of a domain), and that
account must be explicitly granted SQL Server parmissions.

Your error message indicates that you are using Windows authentication, in
which case, the user account under which your ASP.Net application is running
is not registered with SQL Server as a trusted account. Knowing that, your
solution is obvious.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
N

news.microsoft.com

Excellent info!

Thanks Kevin

I fixed it by creating a new login and using that.

I did not know how to give the asp.net a/c which is local on my machine,
access on sql server, as it can only read and understand AD accounts.

My webpages are hosted on another machine than the sql server, thus the
difference.

Thanks.
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top