Skip to content

Instantly share code, notes, and snippets.

@kmlprtsng
Created August 14, 2013 14:56
Show Gist options
  • Select an option

  • Save kmlprtsng/6231814 to your computer and use it in GitHub Desktop.

Select an option

Save kmlprtsng/6231814 to your computer and use it in GitHub Desktop.
Get user the web app service is running under
//http://stackoverflow.com/questions/275824/how-to-find-out-which-account-my-asp-net-code-is-running-under
var user = System.Security.Principal.WindowsIdentity.GetCurrent().User;
var userName = user.Translate(typeof (System.Security.Principal.NTAccount));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment