Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection to SQL Server fails using Impersontion

Status
Not open for further replies.

hexOffender

Programmer
Nov 6, 2006
146
US
I am writing a Web app that will run on our local Intranet.
I want to set it up so that users will be authenticated by Active Directory, then they can run queries etc. I have the authentication working, but when a query is run on the SqlServer(which is on a different server than the IIS box), it is being run under NT AUTHORITY\ANONYMOUS LOGON, and is throwing an exception. I set up a new group in Active Directory that will be able to run this application. I am using impersonation in the web.config and I have the AD group set up on the SQLServer. There is still something not set right though, so I need your help. What else am I missing....
 
Here's an obvious one: what does context does the code think it is running as? Can you debug.writeline the current identity information?

Brian Begy
BugSentry - Automatic error reporting
 
Connection pooled or otherwise opened under the network id instead of the AD user? I'm guessing here.



Brian Begy
BugSentry - Automatic error reporting
 
I believe the connection is under NT AUTHORITY\ANONYMOUS LOGON, that is what is in the exception thrown. I dont want to set up individual users on my SQL server, but i do want them to be able to run queries(read only, there wont be any transaction processing).
 
So are you using integrated security on the sql connection or username/pwd?

If integrated, when do you open it? Before or after AD authentication?



Brian Begy
BugSentry - Automatic error reporting
 
integrated Security on the connection string, and it opens after the AD authentication, when the next page loads and a search parameter is entered.
 
when logged in to the web box can you query the db using your credentials not in asp.net? Like query manager or standalone console app ?

Brian Begy
BugSentry - Automatic error reporting
 
Yes i can query from the web server. I think im not doing something right, or else it would work :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top