DirectoryEntry de = new DirectoryEntry("LDAP://" + "域名", "用戶名", "密碼", AuthenticationTypes.Secure);
DirectorySearcher ds = new DirectorySearcher();
ds.SearchRoot = de;
ds.Filter = ("(objectClass=user)"); group是組
foreach (SearchResult result in ds.FindAll())
{
string name = result.GetDirectoryEntry().Name.ToString();
Page.Response.Write(name);
}
作者:Bychentufeiyang