Click here to Skip to main content
15,037,009 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
I am working on a website which is used to reset password of ldap users.
I am not able to make connection with server over ssl. I tried various code and authentication types.

This is what used on server for connectivity with ldap on which website is hosted.
I also tested it with both ssl ports 636 and 3269.
C#
0 = ldap_set_option(ld, LDAP_OPT_ENCRYPT, 1)
res = ldap_bind_s(ld, NULL, &NtAuthIdentity?, NEGOTIATE (1158)); v.3

    {NtAuthIdentity?: User='_ldapuser'; Pwd='unavailable';; domain = 'SJTPNOC.DOMAIN'}

I am using following code in website
C#
LdapConnection connection = new LdapConnection(new LdapDirectoryIdentifier("SJTP.DOMAIN",636));
             
connection.SessionOptions.ProtocolVersion = 3;

connection.AuthType = AuthType.Basic;

connection.Credential =  new NetworkCredential("CN=user,CN=Users,DC=SJTPNOC,DC=DOMAIN", "password","CN=Users,DC=SJTPNOC,DC=DOMAIN");

            connection.SessionOptions.SecureSocketLayer=true;

 connection.Bind();
Getting exception "LDAP server is unavailable". I tried that code with 389 port and without ssl and its working fine.

Please let me know what is wrong. Help me its urgent.
Posted
Updated 23-Nov-12 20:36pm
v3

1 solution

Just add one more line

connection.SessionOptions.VerifyServerCertificate = new VerifyServerCertificateCallback((con, cer) => true);
   

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