Sunday, August 28, 2011

How to get the machine and windows user name of a logged in user in c#?

The below code will help you to find the Logged in windows user

System.Security.Principal.WindowsIdentity.GetCurrent().Name;

For getting the Machine Name you can use the below code.

WindowsIdentity.GetCurrent().Name;

No comments:

Post a Comment