当前位置:编程学习 > C#/ASP.NET >>

C#获取AD用户信息

 
 
 
  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
补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,