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

18 s
18

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

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *