Skip to content

Instantly share code, notes, and snippets.

@yhau1989
Created January 13, 2020 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yhau1989/ef40b27e86acd68d0c415838c9c7db37 to your computer and use it in GitHub Desktop.
Save yhau1989/ef40b27e86acd68d0c415838c9c7db37 to your computer and use it in GitHub Desktop.
Get Current User .NET C#
protected string detecUser()
{
return (HttpContext.Current.User.Identity.Name.Length > 0) ? HttpContext.Current.User.Identity.Name : System.Security.Principal.WindowsIdentity.GetCurrent().Name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment