Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LdapConnection ldapConnection = new LdapConnection(new LdapDirectoryIdentifier("<ipaddress>:<port>"));
- ldapConnection.AuthType = AuthType.Basic;
- LdapSessionOptions options = ldapConnection.SessionOptions;
- options.SecureSocketLayer = true;
- options.ProtocolVersion = 3;
- X509Certificate cert = new X509Certificate();
- cert.Import(@"E:client.crt");
- ldapConnection.ClientCertificates.Add(cert);
- ldapConnection.Credential = new NetworkCredential("administrator", "xxxxxxxxxx");
- ldapConnection.Bind();
- Console.WriteLine("successfully connected");
- LdapConnection ldapConnection = new LdapConnection(server + ":" + port);
- ldapConnection.AuthType = AuthType.Basic;
- ldapConnection.Credential = new System.Net.NetworkCredential(username,
- password);
- ldapConnection.SessionOptions.ProtocolVersion = 3;
- if (sslEnabled)
- {
- ldapConnection.SessionOptions.SecureSocketLayer = sslEnabled;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement