Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
how to display current username who logging in active directory?
Posted
Comments
Aniket Yadav 8-Feb-12 1:24am    
Do You Have Login Form For This?

If Yes Then Fetch The User Name In A String Variable.

And Then Display That Name.

1 solution

Hi,
Use WindowsIdentity component can get who's logging currently(username) from active directory.
C#
private void GetUser()
{
HttpContext httpContext = HttpContext.Current;
WindowsIdentity winIdentity = (WindowsIdentity)httpContext.User.Identity;
string userIdentity = winIdentity.Name;
}

Regards,
anbukrish.
 
Share this answer
 
v2
Comments
Anuja Pawar Indore 8-Feb-12 3:07am    
Added pre tag

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900