How to read the identity of the impersonated user in ASP.NET

By Santhosh N

This explain how to read the identity of the impersonated user in ASP.NET programatically.

We can read the identity of the impersonated user in ASP.NET using System.Security.Principal using the following API

    System.Security.Principal.WindowsIdentity.GetCurrent();

For example, to get the username of the impersonated account, we can get as below mentioned C# code:

   String impUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Related FAQs

This explain the page life cycle event that is best suited to set the Master Page for the webpage in ASP.NET programatically at runtime.
This explains how to get the root path of the application in C#
This explains about the co-existence of ASP and ASP.Net websites in the same server
This explains the equivalent of ObjectRecordSet.MoveNext ofclassic ASP in Asp.Net
How to read the identity of the impersonated user in ASP.NET  (973 Views)