WindowsIdentity.GetCurrent().Name in ASP.NET

You can use following code, if you want to know the user under which your ASP.NET application is running. 

Add following namespace on top of your web page,
using System.Security.Principal; 

Add following code to Page_Load event,
WindowsIdentity id = WindowsIdentity.GetCurrent();                
Response.Write("Account Name: " + id.Name + "<br>");

No comments:

Post a Comment