using (LdapConnection ldap = new LdapConnection("localhost:389"))
{
//ldap.AuthType = AuthType.Basic;
ldap.Bind(new NetworkCredential("cn=manager,dc=wave,dc=com", "secret"));
}我用Authentication类型尝试了这两种方法,并将authentication类型设置为basic。但是它会给出一个错误‘该可分辨名称包含无效的语法’
还有一件事,我不能使用System.DirectoryServices,因为它只适用于Active Directory,这就是我使用System.DirectoryServices.Protocol的原因。
谢谢!
发布于 2012-06-26 22:34:08
这个MSDN blog post可能会对你的问题有所帮助。试试这个:
using (LdapConnection ldap = new LdapConnection("localhost:389"))
{
ldap.AuthType = AuthType.Basic;
ldap.SessionOptions.ProtocolVersion = 3;
ldap.Bind(new NetworkCredential("cn=manager,dc=wave,dc=com", "secret"));
}https://stackoverflow.com/questions/11204003
复制相似问题