I try to connect to LDAP server using SSL and get the error
The distinguished name contains invalid syntax
Code:
string userName = "1n07op"
LdapDirectoryIdentifier ldi = new LdapDirectoryIdentifier("myddc01.swinfra.net",636);
LdapConnection ldapConnection = new LdapConnection(ldi);
ldapConnection.Credential = new NetworkCredential(userName, password);
ldapConnection.SessionOptions.SecureSocketLayer = true;
ldapConnection.SessionOptions.ProtocolVersion = 3;
ldapConnection.SessionOptions.VerifyServerCertificate = new VerifyServerCertificateCallback(ServerCallBack);
ldapConnection.AuthType = AuthType.Basic;
ldapConnection.Bind();
ldapConnection.Dispose();
return true;
Can anyone help my solve this problem?
Assuming that the username "1n07op", you need to include the type of this attribute you are using, for example cn, ou, uid, sn
plus the full dn
where your user exists in the ldap, thus, to successfully bind to your ldap you will need to have your username set to something like this:
String userName="uid=1n07op,ou=people,ou=company,ou=com"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.