반응형

C# 윈도우즈 계정 및 컴퓨터 이름 불러오기

 

C#에서 윈도우즈 계정과 컴퓨터 이름을 불러올때 사용. 

   

[윈도우즈 계정]

 textBox1.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

   

계정에서 도메인 명을 뺀 이름만 추출하고 싶을 때.

 textBox1.Text = (System.Security.Principal.WindowsIdentity.GetCurrent().Name).Split('\\')[1];

   

[컴퓨터 이름]
 textBox2.Text =   SystemInformation.ComputerName; 

   

반응형

'SW Engineering > Programming' 카테고리의 다른 글

C# 가비지 컬렉터  (0) 2015.07.22
ASP.NET에서 MySQL 연결  (0) 2015.07.16

+ Recent posts