CurrentUserName (WebSecurity Ref)

The CurrentUserName property will get the logged in user's username. It takes no arguments.

Example

if (WebSecurity.IsAuthenticated)
{
  msg = "Welcome " + WebSecurity.CurrentUserName;
}

Make sure that the user is logged in before getting the username.

Sponsored Links