Credentials for Changing Password in IIS

  • Thread starter Thread starter - Steve -
  • Start date Start date
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?
 
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
 
Back
Top