Check IIS Application Pool Identity using C#

To check the IIS Application Pool Identity using C#, use the System.Security.Principal class:

using System.Security.Principal;

then add the following code to the Page_Load method:

WindowsIdentity id = WindowsIdentity.GetCurrent();
Response.Write("IIS Application Pool Identity
"); Response.Write("Name: " + id.Name + " ");