我正在开发一个网站来管理 ldap。我陷入了一种情况,当我尝试对帐户锁定或禁用的用户进行身份验证时,它失败了。我想要做的是在显示帐户被锁定或禁用的消息之后首先对用户进行身份验证。
我正在这样编码
LdapConnection connection = new LdapConnection(new LdapDirectoryIdentifier("SJTPNOC.com", 636));
connection.SessionOptions.VerifyServerCertificate = new VerifyServerCertificateCallback((con, cer) => true);
connection.SessionOptions.ProtocolVersion = 3;
connection.AuthType = AuthType.Basic;
connection.SessionOptions.SecureSocketLayer = true;
connection.Timeout = new TimeSpan(0, 0, 10);
connection.Credential = new NetworkCredential(username, password);
using (connection){
connection.Bind();
}