Home
Manage Your Code
Snippet: Get current windows user - username (C#)
Title: Get current windows user - username Language: C#
Description: Get current windows user - username Views: 3891
Author: Brendan Le Date Added: 9/28/2008
Copy Code  
1using System.Security.Principal;
2
3namespace ConsoleApplicationWindowsUser
4{
5    class Program
6    {
7        static void Main(string[] args)
8        {
9            string a;
10            a = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
11
12            Console.WriteLine(a);
13            Console.Read();
14        }
15    }
16}