In .net when a website hosted in IIS how do you get the current user the website is running under. ie the Application Pool user not the the current user accessing the site.
Using windows integrated and impersonate.
<authentication mode="Windows"/>
<identity impersonate="true"/>
To revert to the app pool user in managed code you can do the following:
using (WindowsIdentity.Impersonate(IntPtr.Zero))
{
//This code executes under app pool user
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With