Server not Operational while accessing through SSL

213 views Asked by At

My code works fine when not using ssl and connecting through port 389. But if I try to connect through 636 it shows server not operational although port is open. My Code:

DirectoryEntry entry = new DirectoryEntry("LDAP://52.xyz.xyz.151:636", admin,password, AuthenticationTypes.SecureSocketsLayer | AuthenticationTypes.Secure);
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.Filter = "(&(objectCategory=User)(objectClass=person))";
SearchResultCollection allUserDetails = searcher.FindAll();
foreach (SearchResult user in allUserDetails)
{
        Console.WriteLine(user.Properties["name"][0].ToString());
}

The above code works fine if I create the DirectoryEntry with port 389 as:

DirectoryEntry entry = new DirectoryEntry("LDAP://52.xyz.xyz.151:389", admin,password, AuthenticationTypes.Secure);

The following variations also did not work

(using LDAPS instead of LDAP->didnot work)

DirectoryEntry entry = new DirectoryEntry("LDAPS://52.xyz.xyz.151:636", admin,password, AuthenticationTypes.SecureSocketsLayer | AuthenticationTypes.Secure);

or (using LDAPS instead of LDAP->didnot worknot writing port name)

DirectoryEntry entry = new DirectoryEntry("LDAP://52.xyz.xyz.151", admin,password, AuthenticationTypes.SecureSocketsLayer | AuthenticationTypes.Secure);
0

There are 0 answers