Home /

| RSS

Get Current Windows User In C#

This snippet will show you how to get the currently logged in user on windows.
System.Security.Principal.WindowsIdentity identity =
System.Security.Principal.WindowsIdentity.GetCurrent();

Console.WriteLine(identity.Name);

[ More ] May 12th, 2009 | No Comments | Posted in Code Snippets |