1

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. do i need to provide any NetworkCredentials?

Every time the findAll is called it is saying that

the server is not operational

ldapUrl="LDAP://x500.bund.de:389/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();
logeeks
  • 4,849
  • 15
  • 62
  • 93
  • possible duplicate of [C#: How to connect to Active Directory with SSL enabled?](http://stackoverflow.com/questions/1228998/c-how-to-connect-to-active-directory-with-ssl-enabled) – marc_s Sep 16 '11 at 14:49
  • See that other SO question - I believe you need to use port 636 (instead of 389) for SSL connections... – marc_s Sep 16 '11 at 14:49

1 Answers1

3

389 is the LDAP plaintext port. You can't use SSL over it unless you use the STARTTLS directive and the server is configured to support it. Try 636 as suggested by marc_s.

user207421
  • 305,947
  • 44
  • 307
  • 483