C# LDAP SSL connection fails
I am using the following code to connect to aLDAP server using SSL. The following code will work only if i turn off the SSL flag. Can any one please tell me what am i missing here to do a SSL connection.
Every time the findAll is called it is saying that
the server is not operational
Do i need to provide any NetworkCredentials?
Code:
ldapUrl="LDAP://x500.bund.de:636/l=Neutral,ou=BMI,o=Bund,c=DE";
DirectoryEntry dEntry =null;
// for anonymous login. x500.bund.de supports this.
dEntry = new DirectoryEntry(ldapUrl, null, null,
AuthenticationTypes.SecureSocketsLayer | AuthenticationTypes.Secure);
DirectorySearcher search = new DirectorySearcher(dEntry);
search.Filter = "((objectClass=*))";
search.Filter = searchQuery;
SearchResultCollection scl = search.FindAll();
Re: C# LDAP SSL connection fails
That's usually a certificate issue.
Check the system event log on the client machine and see if there are any ssl/schannel errors.
In case these errors are being suppressed: Make sure that the certificate matches everything you're expecting. Host name, expiration, etc.
Re: C# LDAP SSL connection fails
I suggest you use Softtera Ldap software to test connections to Ldap before trying with the code. It will give you detailed error.