Jar*_*red 5 ssl directoryservices ldap ldapconnection
我正在尝试修复产品中的SSL错误,并注意到虽然代码将SSL设置为true,但在代码SSL的下一行仍然是false.我为此编写了一个单元测试,单元测试证实了我的怀疑.
[TestMethod]
public void SecureSocketLayerSetToTrue( )
{
var ldapConnection = new LdapConnection(
new LdapDirectoryIdentifier( "ldap.test.com", 636 ));
ldapConnection.SessionOptions.SecureSocketLayer = true;
Assert.IsTrue( ldapConnection.SessionOptions.SecureSocketLayer );
}
Run Code Online (Sandbox Code Playgroud)
测试失败.这里有什么东西让我失踪吗?
事实证明,DirectoryServices.Protocols实现它的LDAP调用的方式是将它们传递给低级LDAP API.在对属性执行get时,将查询此LDAP API.
只有在执行方法时才会更新低级API.您可以考虑这一点,就像它正在为尚未启动的可执行文件构建命令行参数.
当进行类似Bind()的调用时,将启动可执行文件,并且属性将报告正确的值.
所以,仅仅因为该属性说该值为false,它在必要时使用了true.
| 归档时间: |
|
| 查看次数: |
2175 次 |
| 最近记录: |