有谁知道是否可以获得任何 LDAP 对象的属性 X 的值?似乎 .NET 或 ADSI 删除了它无法处理的内容(de.Properties.Values.Count == de.Properties.PropertyNames.Count > de.Properties.Values.props.valueTable.Count)。
binddn.Text = "cn=admin,o=system";
bindpass.Password = "XXXXX";
server.Text = "10.X.X.X";
basedn.Text = "cn=server,o=system";
StringBuilder basepath = new StringBuilder("LDAP://");
basepath.Append(server.Text).Append("/").Append(basedn.Text);
DirectoryEntry myDirectoryEntry = new DirectoryEntry(basepath.ToString());
myDirectoryEntry.Username = binddn.Text;
myDirectoryEntry.Password = bindpass.Password;
myDirectoryEntry.AuthenticationType = AuthenticationTypes.ServerBind;
foreach (string key in myDirectoryEntry.Properties.PropertyNames)
{
object val = myDirectoryEntry.Properties[key].Value;
}
这在二进制字段(http://ldapwiki.willeke.com/wiki/Ldapsearch%20Networkaddress)的 networkAddress 属性上崩溃。