Get Logged In User With ASP.Net
Using the following three ways we can get the User Name using C#
1 2 | System.Security.Principal.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal; string strName = p.Identity.Name; |
1 | string strName = HttpContext.Current.User.Identity.Name.ToString(); |
1 2 | string strName = Request.ServerVariables["AUTH_USER"]; //Finding with name string strName = Request.ServerVariables[5]; //Finding with index |
(for Ex: Microsoft\Bill.Gates. Here Microsoft is domain Bill.Gates is Logger User Name )
Using string operations seperate the DomainName and UserName.

