Impersonate another user

TheWizardofInt

Well-known member
Joined
Dec 31, 1969
Messages
333
Location
Orlando, FL
Does anyone have a code example for how to impersonate another user on the web server.

My ASPNET user cant access the active x dll that I have to use, and rather than spend three more days trying to figure it out I am going to try using a different user.
 
Code:
<!-- In web.config -->
<identity impersonate="true" />

[mshelp]ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconaspnetimpersonation.htm[/mshelp]
 
Thanks for the fast reply

I tried this:

<identity impersonate="true" userName="BOB" password=""/>
<authentication mode="Windows" />

And it came back as unable to verify. I also tried it with the PC name before BOB with a slash

Any ideas?
 
Ok, found out how to do this

Create a User in Windows with a password (the thing has trouble with blank passwords)
Give the User the rights you want it to have
In Machine.Config, which is in the WINNT/Microsoft.Net/Framework/(numeric)/Config directory, seach for the userName=(machine) and reset the username and password to the new user

Use THIS and not the web.congif file, and it works really well
 
Back
Top