Is there a way to find out what identity an MVC web application is impersonating?
I’ve set web.config to include
<system.web>
<identity impersonate="true" />
For IIS7 in integrated pipeline mode, I believe this should make the application impersonate IUSR (my thinking is set out in my blog post Identity impersonation with IIS and ASP.NET.
The MVC application itself uses Forms Authentication, and I can see the logged in user ok at
System.Web.HttpContext.Current.User.Identity
But my application then has to call a COM component, and I need to be sure what account it is using. From my tests, it still seems to be using NETWORK SERVICE, rather than IUSR, so I’m looking for a way to verify which identity the application is impersonating when calling the COM component.
Take a look at
System.Security.Principal.WindowsIdentity.GetCurrent().User