Wednesday, September 14, 2011

find your Active Directory username with System.Security.Principal

Sniff your Active Directory username like so:

public static string userName = WindowsIdentity.GetCurrent().Name;

 
 

Use this namespace:

using System.Security.Principal;

No comments:

Post a Comment