Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework
Impersonate call fails even after duplicating token
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Guest, post: 3676848"] here is the code: IntPtr token1 = IntPtr.Zero; int loggedOn = -1; loggedOn = LogonUser(lpszUsername,lpszDomain,Pwd,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,ref token1); if(loggedOn == 1) { IntPtr dupeTokenHandle = new IntPtr(0); bool retVal = DuplicateToken(token1, SecurityImpersonation, ref dupeTokenHandle); WindowsIdentity newId = new WindowsIdentity(dupeTokenHandle); CloseHandle(dupeTokenHandle); CloseHandle(token1); System.Security.Principal.WindowsImpersonationContext wimp = newid.Impersonate(); } The Impersonate() line fails with this error: System.Security.SecurityException: Unable to impersonate user. [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework
Impersonate call fails even after duplicating token
Top