如果你想获取当前的用户:(只能获得一个用户)
AuthUser.Text = User.Identity.Name;
AuthType.Text = User.Identity.AuthenticationType;
IsAuthenticated.Text = User.Identity.IsAuthenticated.ToString();
如果你想要获得所有WinNT用户:
#region 获取Domain中的User列表,返回ArrayList
public static ArrayList GetDomainUser()
{
ArrayList UserList = new ArrayList();
String strPath="LDAP://RootDSE";
DirectoryEntry ent = new DirectoryEntry(strPath);
String str = ent.Properties["defaultNamingContext"][0].ToString();
DirectoryEntry domain = new DirectoryEntry("LDAP://"+str);
foreach(DirectoryEntry child in domain.Children) 
{
 
foreach(DirectoryEntry Nodes in child.Children)
{
string strName =Nodes.Name.Substring(3);
switch (Nodes.SchemaClassName) 
{
case "user" :
UserList.Add(strName);
break;
}
}
}
return UserList;
}
#endregion//其中获取用户的各种信息和上面的获取一个用户的方法基本上是一致的