Friday, 15 April 2016

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



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


Answer



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

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...