C# Class ImpersonationUtil, code

Impersonate a windows logon.
Show file Open project: shendongnian/code

Public Methods

Method Description
Impersonate ( string logon, string password, string domain ) : bool

Impersonate given logon information.

UnImpersonate ( ) : void

Unimpersonate.

Private Methods

Method Description
DuplicateToken ( IntPtr, hToken, int impersonationLevel, IntPtr, &hNewToken ) : int
LogonUser ( string lpszUserName, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, IntPtr, &phToken ) : int

Method Details

Impersonate() public static method

Impersonate given logon information.
public static Impersonate ( string logon, string password, string domain ) : bool
logon string Windows logon name.
password string password
domain string domain name
return bool

UnImpersonate() public static method

Unimpersonate.
public static UnImpersonate ( ) : void
return void