我正在开发一个与活动目录交互并执行某些用户操作的网站。我希望在服务器脱机时处理超时情况。 我编码像这样
LdapConnection connection = new LdapConnection(new LdapDirectoryIdentifier(this._domain, Convert.ToInt32(this._port)));
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);