Sometimes it is necessary to change the user under whose account asp.net runs to execute a special method. This could be the case e.g. if you want to access an ADS with a local asp.net user and you get an error message "invalid username or password" (there is the possibility to pass a username and passwort, but that didn't work for me).
The usage of the class below is very simple:...Impersonation imp = new Impersonation();imp.ImpersonateValidUser("username", "domain", "password"); //execute your work hereimp.UndoImpersonation();....using System;using System.Security.Principal;using System.Runtime.InteropServices;namespace Security{
[
Remember Me
Powered by: www.ie-soft.de
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2010, Manuel Trunk
E-mail