Credentials for Changing Password in IIS

S

- Steve -

I have an ASP.NET webpage that allows an admin to change a password on a
user account. I know I can use the properties DirectoryEntry.Username, and
DirectoryEntry.Password to use as the credentials on the operation.

How can I use the credentials that they used to log into IIS though? If I
don't set those two properties I get an error message that the ASP.NET
account does not have permission to use these resources. How do I get the
credentials of the logged on user to be used?
 
A

Abhijeet Dev

It will require runtime thread impersonation, which has been declared in
Advapi library(win32). In longhorn SDK, it will be possible.
In .NET you can have a look at this page, to achieve something similar:
http://msdn.microsoft.com/library/d...cipalWindowsIdentityClassImpersonateTopic.asp

Although I am not sure, but this should work.

Another and probably better approach would be to impersonate the user using
custom principal and then set System.Threading.Thread.CurrentPrincipal to
the custom principal.

Abhijeet Dev
 

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