Impersonation is a process whereby an application assumes another identity or security context during execution.
Questions tagged [impersonation]
1522 questions
5
votes
4 answers
What is RevertToSelf()? - C#.net
I don't understand what RevertToSelf() does in a .net application. Checking MSDN definition it reads the definition as
The RevertToSelf function terminates the impersonation of a client application.
So does the current user context changes to a…

NLV
- 21,141
- 40
- 118
- 183
5
votes
2 answers
Setting size of TOKEN_PRIVILEGES.LUID_AND_ATTRIBUTES array returned by GetTokenInformation
I'm trying to retrieve the privileges and their current state associated with a token in C# but i can't figure out how to adjust the size of the LUID_AND_ATTRIBUTES array that is returned to fit the actual number of elements.
From MSDN
When…

JoshHetland
- 1,273
- 1
- 12
- 22
5
votes
1 answer
Understanding impersonation permissions
I have an ASP.NET web application using Windows authentication and impersonation. Here's the relevant part of web.config:
The application code now tries to access a file…

Heinzi
- 167,459
- 57
- 363
- 519
5
votes
2 answers
Impersonation the current user using WindowsImpersonationContext to access network drive
I need to access a remote drive from a Web App. The drive isn't accessible to the ASP.NET process, so I want to impersonate the current user for the request.
I saw some basic examples using WindowsImpersonationContext, and have tried the following. …

fearofawhackplanet
- 52,166
- 53
- 160
- 253
5
votes
0 answers
Office 365 - EWS Managed API 2.0 Impersonation 401 unauthorized/503 not available
private ExchangeService connectToEWS(string email, bool impersonate = false) {
WebCredentials credentials = new WebCredentials(username, password, domain);
ExchangeVersion version = (ExchangeVersion)exchangeVersion;
ExchangeService service…

Doug
- 149
- 2
- 11
5
votes
1 answer
Mutex creation hangs while using impersonation
While testing an application, I ran a into strange behaviour. Some of the tests use impersonation to run code as a different user, but they would always hang, never complete.
After some investigation, the problem was narrowed down to the use of…

molnarm
- 9,856
- 2
- 42
- 60
5
votes
2 answers
IIS 7 impersonation and identities
I'm trying to get used to II7, having worked with IIS6 for quite some time.
In IIS 6, I'd set in the web.config, and make sure that I applied the correct NTFS permissions to the IUSR_[MACHINENAME] account if a folder…

ScottE
- 21,530
- 18
- 94
- 131
5
votes
2 answers
File.Exists acts differently when access is denied to the file vs denied to the dir
Based on the MSDN documentation of File.Exists, the File.Exists method should return false on any error, including the caller not having access to read the file.
I would expect it to return false both when the file is set to FullControl denied to…

Middas
- 1,862
- 1
- 29
- 44
5
votes
2 answers
How do you run another .exe from VB.NET as another User?
How do you run another .exe from VB.NET but as another User?
I expect to launch a .exe like "Left Click -> Run As -> Enter User/Pass -> Click OK"
If I do that, my application runs as expected (I need to run it as another user to get access to some…

figus
- 307
- 2
- 15
5
votes
1 answer
Impersonating a user in wrong domain doesn't throw exception
I used the common impersonation code and it worked just fine, until I inserted random 'dggdgsdg' in domain - and it worked nonetheless...
if (LogonUser(Username, Domain, Password, Logon32LogonInteractive, Logon32ProviderDefault, ref…

Rita
- 1,448
- 1
- 14
- 22
5
votes
1 answer
IEDriverServer raises error when using impersonation
I'm trying to test an ASP.NET MVC4 web application connecting with different users at the same time using impersonation. So, the idea for the test was to execute several instances of the driver each with a different impersonated user. It sounds…

yeyeyerman
- 7,751
- 7
- 43
- 52
5
votes
1 answer
ASP.NET PowerShell Impersonation
I have developed an ASP.NET MVC Web Application to execute PowerShell scripts.
I am using the VS web server and can execute scripts fine.
However, a requirement is that users are able to execute scripts against AD to perform actions that their own…

Ben Foster
- 34,340
- 40
- 176
- 285
5
votes
1 answer
Custom web service in SharePoint 2013 with impersonation
For SharePoint 2010 we used custom web services (NOT SOAP!) to make some 3rd party data available to JS code in the pages displayed by the browser. This was sensitive data so we used impersonation to ensure that only the right users were able to…

Peter P.
- 191
- 1
- 6
5
votes
1 answer
Change the context of a thread to other user
A user triggers a event, thus the thread is in the context of said user.
I iterate over all connected users and want to send them this event, but I want to use classic Authorization to determine if they should receive the event. Problem is the…

Anders
- 17,306
- 10
- 76
- 144
5
votes
3 answers
Write to file as Different User
I am trying to write to a file that my local user account does not have access to, how can I open and write to the file as an administrator?

user2570202
- 77
- 3