Request ServerVariables Common Task

ASP.Net Get name of current user

Get the name of the current user.
When a person on your intranet request a page you want to get that persons username.
string nameOfUserAccount = Request.ServerVariables["AUTH_USER"]);
string userName = nameOfUserAccount.Split("\")[1];
Dim nameOfUserAccount As String = Request.ServerVariables("AUTH_USER")
Dim userName = nameOfUserAccount.Split("\")(1)
Related ServerVariables AUTH_USER
     << Back