登录名 cn=ldap_xbtl
密码 password
目录URL ldap://10.68.110.65:389/
BaseDN dc=hq,dc=com
DirectoryEntry entry = new DirectoryEntry("LDAP://10.68.110.65:389/,DC=hq,DC=com","ldap_xbtl
","password",AuthenticationTypes.None);  老是报错,不知道怎么办好,请大侠帮忙

解决方案 »

  1.   

    //bc:机器名 
    //bo:组织名 
    //域名:bc.com.cn string strPath = "LDAP://bc/OU=bo,DC=bo,DC=com,DC=cn"; 
       DirectoryEntry de; 
       de = new DirectoryEntry(strPath,"administrator" ,"btmainsvr1234",AuthenticationTypes.None);  
       DirectorySearcher deSearch = new DirectorySearcher(); 
       deSearch.SearchRoot =de; 
       deSearch.Filter = "(&(objectClass=user)(sAMAccountName=willpower))"; 
       deSearch.SearchScope = SearchScope.Subtree; 
       SearchResult results= deSearch.FindOne(); 
       de=new DirectoryEntry(results.Path,"administrator" ,"",AuthenticationTypes.None);