WindowsIdentity identity = new WindowsIdentity(accessToken);
WindowsImpersonationContext context = identity.Impersonate();
...
context.Undo();
Where do i declare a administraotr UserName and Passowrd ?
the accessToken param doesn’t help me too much…
Do I have to import DLL’S for it ?
You need to get the user’s token. Use the p/invoke
LogonUserfrom the advapi32.dll:Example: