I am new to LDAP. I am trying to connect to LDAP using my certificate credentials and no user name and password. The code i am using is
LdapConnection ldapConnection = new LdapConnection(new LdapDirectoryIdentifier("ldap://192.168.10.5:636"));
ldapConnection.AuthType = AuthType.Anonymous;
LdapSessionOptions options = ldapConnection.SessionOptions;
options.SecureSocketLayer = true;
options.ProtocolVersion = 3;
X509Certificate cert = new X509Certificate();
cert.Import(@"c:\certfolder\mycert.crt");
ldapConnection.ClientCertificates.Add(cert);
ldapConnection.Bind();
The above code is giving me error "The LDAP server is unavailable" when compiler tries to run line ldapConnection.Bind();.
When i place a breakpoint at line1 it gives the following error. base{system.DirectoryService.Protocols.DirectroyException}{"The server cannot handle directory request."}
Same code without prefix worked for me.
or
Both are working fine.