Trusted connection to SQL

K

kai

Hi, All

When I create a trusted connection from ASP.NET to SQL Server, I receive the
following error message:

Login failed for user 'MachineName\ASPNET'

I looked Knowledge base artical


http://support.microsoft.com/default.aspx?scid=kb;en-us;316989

but I do not ubderstand the solution:

"Programmatically change the security context of the ASP.NET worker process
to a user who has the correct SQL Server permissions."


Where do I change the security contex? Please help.

Thanks

Kai
 
K

Karl

In the web.config you can enable impersonation in the system.web section
via:

<identity impersonate="true" userName="USERNAME" password="PASSWORD"/>

If you leave the userName blank, it'll assume the identity of the user
requesting the page (which will be the IUSR_MachineName if you enable
anonymous access, or the windows account of the user if you don't allow
impersonation).

Karl
 
K

kai

Karl,
Thanks for your help.

After I insert the <identity impersonate="true" userName="USERNAME"
password="PASSWORD"/>


I get this:

Server Error in '/WebApplication9' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Could not create Windows user token from the
credentials specified in the config file. Error from the operating system
'Logon failure: unknown user name or bad password. '

Source Error:


Line 82: -->
Line 83: <globalization requestEncoding="utf-8" responseEncoding="utf-8"
/>
Line 84: <identity impersonate="true" userName="ASPNET" password="" />
Line 85:
Line 86: </system.web>


Source File: c:\inetpub\wwwroot\WebApplication9\web.config Line: 84


What did I do wrong?

Thanks

Kai
 

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

Top