Click here to Skip to main content
15,791,739 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am working on a C# windows application, I have now faced a problem while authenticating a domain user with LDAP over SSL.

When I authenticate the user with BASIC authentication type the bind is successful, but while authenticating otherwise it is showing and error "LDAP Server is unavailable".

Why I try to authenticate with LDAP over SSL?
We have a client requirement where in the information of the AD is leaked (unencrypted information like DC=DomainName,DC=COM and other secured information) while using a security assessment tool "Echo Mirage". To over come this we need a secured way of authenticating the user credentials.

Here is the code I use, we analyzed on many such codes, but were not able to solve the purpose.

PrincipalContext domainContext = new PrincipalContext(ConteyxtType.Domain, serverIP);
               isValid = domainContext.ValidateCredentials(username, password, ContextOptions.Negotiate | ContextOptions.SecureSocketLayer);

LdapConnection connection = new LdapConnection(serverIP);
NetworkCredential credential = new NetworkCredential(username, password);
connection.Credential = credential;
Console.WriteLine("logged in");

Can anyone help us in this and point us in the right direction.

And the configuration of LDAP in the SERVER is working fine.

Thanks in advance.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900