Loading ...

Effects of impersonation on WindowsIdentity.GetCurrent().Name property | CodeAsp.Net

Effects of impersonation on WindowsIdentity.GetCurrent().Name property

 /5
0 (0votes)

Following are the outcomes of my test which I did in my ASP.NET site with app pool set as "Network Service" identity. I did these tests with Forms Authentication.

Case 1: When impersonation is false i.e

<identity impersonate="false" />

System.Security.Principal.WindowsIdentity.GetCurrent().Name will give "NT AUTHORITY\NETWORK SERVICE" value.

If you try to do System.Web.Hosting.HostingEnvironment.Impersonate() even then it will give you  "NT AUTHORITY\NETWORK SERVICE" value.

 

Case 2: When impersonation is set to true i.e

<identity impersonate="true" />

System.Security.Principal.WindowsIdentity.GetCurrent().Name will give "NT AUTHORITY\IUSR" value.

If you try to do System.Web.Hosting.HostingEnvironment.Impersonate() even then it will give you  "NT AUTHORITY\NETWORK SERVICE" value.

 

Case 3: When impersonation is set to true and set with credentials i.e

<identity impersonate="true" userName="My-PC\Administrator" password="test"/>

System.Security.Principal.WindowsIdentity.GetCurrent().Name will give "My-PC\Administrator" value.

If you try to do System.Web.Hosting.HostingEnvironment.Impersonate() even then it will give you  "NT AUTHORITY\NETWORK SERVICE" value.

Comments (no comments yet)

Top Posts