1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
using System.Security.Principal;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal (identity);
Console.WriteLine(principal.Identity.Name);
}
}
}
|