简体   繁体   中英

error on connecting to OpenLDAP using LdapConnection

        using (LdapConnection ldap = new LdapConnection("localhost:389"))
        {
            //ldap.AuthType = AuthType.Basic;
            ldap.Bind(new NetworkCredential("cn=manager,dc=wave,dc=com", "secret"));
        }

I tried with both with Authentication type as well with authentication type as basic. but it gives an error that 'The distinguished name contains invalid syntax'

One more thing, is that I can't use System.DirectoryServices, because it works perfect only for Active Directory, thats why I am using System.DirectoryServices.Protocol.

Thanks!

This MSDN blog post may shed some light on your problem. Try this:

    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"));
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM