I am trying to impersonation a user in my C# code to open a file share in Windows Explorer. BUT IT IS NOT WORKING! My code is below.
Impersonator i = new Impersonator();
using (new Impersonator("userA", "domainA", "pa$$word", LogonType.LOGON32_LOGON_INTERACTIVE, LogonProvider.LOGON32_PROVIDER_DEFAULT))
{
Process.Start(@"c:\windows\explorer.exe", @"\\fileshare\abc");
Response.Write("Impersonated User: " + WindowsIdentity.GetCurrent().Name + "<br />");
Response.Write("Logon User: " + Request.ServerVariables["LOGON_USER"] + "<br />");
Response.Write("Authenticated User: " + Request.ServerVariables["AUTH_USER"] + "<br />");
}
I am using the code to do the impersonation from this site:
http://platinumdogs.wordpress.com/2008/10/30/net-c-impers ...
Go to the complete details ...