需求,可以连接到LDAP上面。但查看了一些资料,需要指定DirectoryEntry的path。
上网查了下:找到如下:
DirectoryEntry entryPC = new DirectoryEntry("LDAP://192.168.2.59:389/", "aaa", "111", AuthenticationTypes.None);            DirectorySearcher deSearch = new DirectorySearcher();
            deSearch.SearchRoot = entryPC;
            deSearch.Filter = "(&(objectClass=user)(sAMAccountName=willpower))";
            deSearch.SearchScope = SearchScope.Subtree;
            SearchResult results = deSearch.FindOne();
            entryPC = new DirectoryEntry(results.Path, "dmp", "", AuthenticationTypes.None);   但实际连接不行.
原因如下:
我连接的服务器为linux,用户名是aaa,密码是111,但LDAP的密码是bbb,DN是cn=Manager,dc=mydc.
根据这个环境,实在不知道怎么实例化对象。求解。谢谢