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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when using Integrated Security

Status
Not open for further replies.

Lbob

Programmer
Joined
May 23, 2003
Messages
157
Location
GB
Hi

I'm an ASP.NET newbie and am having a few problems connecting to our SQL Database.

I have got a really basic ASP.NET page that is connecting to a database and returning a list of users. The IIS is on my PC and I'm trying to connect to one of our SQL Servers on another box. I've updated the security setting in IIS to be windows integrated security. The SQL Server currently only accepts Windows Security. However I'm getting the following error...

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

If I copy the same code into a new Windows Application and run it, it works fine?!

Please help, thanks
Lbob
 
This is because when you run as a Windows Forms, it's a completely different security context.

You have two options here:

(1) Add your machine's ASPNET user to the SQL Server logins.

(2) Have ASP.NET impersonate a different account.

To do #2, open up your machine.config file:

\winnt\microsoft.net\framework\vxx.xx.xx\config
Go down to the <processModel /> section and change the username/password combo from machine/autogenerate to DOMAIN\username / password

This will make ASP applications run under the user that you specify and therefore give them the permissions that they need to be able to access the database.

-paul

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
Thanks

Is there anyway it can impersonate the person logging on?

Basically I've set IIS to be Integrated Security as well and I want to pass trhough to the server the username and password they are using, I don't really want to hard code who they are impersonating.

lbob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top