How do I get the current username in .NET using C#?

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Leave a Comment