How do I get the identity of an appPool programmatically in C#? I want the application pool user and NOT the user who is currently logged in.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
You could use
System.Security.Principal.WindowsIdentity.GetCurrent().Name
to identify the Identity in which the current application is running. This link provides a nice utility which displays the identity under which the aspx is run.You need to make a reference to Microsoft.Web.Administration (in Microsoft.Web.Administration.dll). Microsoft.Web.Administration.dll is located in C:\Windows\System32\inetsrv.