How can I login to AD without logout from current user and get new logged user’s rights. (OS: Windows XP)
Note:
Not to Modify AD or something like this.Only wanna to login with another user from C# and getting new login’s permissions/rights. (I wanna use this rights not only in current thread but also whole explorer. Like deleting files, creating directories, changing Network options.)
Is this possible?
You can use impersonation to change thread identity to a different user, given a valid username and password. There is no way to change the user identity for the whole shell other than logging in as a different user manually, but anything executed on the thread you impersonate on will receive the new rights.
The .NET 1.1 way, using P/Invoke:
The .NET 2+ way, using Thread.CurrentPrincipal: