all groups > sql server connect > november 2006 >
You're in the

sql server connect

group:

problem with trusted connection (asp.net)


problem with trusted connection (asp.net) Mad Scientist Jr
11/14/2006 4:33:12 PM
sql server connect: I am getting the following error when trying to access a database with
a trusted connection:

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

My connection string is:

"Server=MyServer; Database=MyCatalog; Trusted_Connection=True;"

Note that Anonymous Access is off in IIS, and I am able to read my
Windows login with:

Textbox1.text =
System.Web.HttpContext.Current.User.Identity.Name.Substring(System.Web.HttpContext.Current.User.Identity.Name.IndexOf("\")
+ 1).ToLower()

Can anyone explain how to query the db using a trusted connection?

PS Is there a way to dynamically retrieve a list of databases the
current user has SQL rights on, by specifying only the server, again
using trusted connection?

Thanks...
Re: problem with trusted connection (asp.net) Hari Prasad
11/14/2006 9:33:36 PM
Hello,

Have you added the OS user into the SQL Server? If not add the particular
user into SQL Server Logins and try connecting.

Thanks
Hari




[quoted text, click to view]

Re: problem with trusted connection (asp.net) Damien
11/15/2006 12:31:08 AM
[quoted text, click to view]

You're almost certainly encountering the "double hop" issue. This
arises when IIS and SQL Server are on separate servers. If that isn't
true in your circumstance, then ignore the rest of this post.

The problem arises because your client machine authenticates you to the
IIS server, but the IIS server has no means of authenticating you to
the SQL Server box (It can't make the second "hop" of authentication).
There was a superb MSDN Magazine article some time back that describes
this, but I can't seem to find it right now. I have found this
knowledge base article:

http://support.microsoft.com/kb/810572

which seems to cover the same areas.

Damien
AddThis Social Bookmark Button