BreakHead
BreakHead

Reputation: 10672

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!

Upvotes: 5

Views: 5682

Answers (1)

Alan
Alan

Reputation: 466

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

Upvotes: 13

Related Questions