1
string path = "LDAP://192.168.0.20/CN=users,DC=company,DC=ltm,DC=dom";

DirectoryEntry dir = new DirectoryEntry(path, admin, pass, AuthenticationTypes.ServerBind);

object value = dir.Properties["description"].Value;
dir.Properties["description"].Value = "test";
dir.CommitChanges();

このコードは、dir.Properties["description"].Value で「無効な DN 構文」という COMException を生成します。

ユーザー名とパスワードを指定せず、DirectoryEntry の初期化を次のように置き換えた場合:

DirectoryEntry dir = new DirectoryEntry(path);
dir.AuthenticationType = AuthenticationTypes.ServerBind;

その後、CommitChanges で UnauthorizedAccessException が発生します。

何が間違っているかについてのアイデアは大歓迎です。

4

2 に答える 2

1

指定せずに試しましたAuthenticationTypesか?

と同じように:

DirectoryEntry dir = new DirectoryEntry(path, admin, pass);
于 2010-01-22T10:01:04.060 に答える
0

パスワードとユーザー名なしでログインしようとすると、UnauthorizedAccessが表示されます。

これは実際にはLDAPサーバーの構成方法によって異なりますが、匿名アクセスは許可されていないようです。

LDAP:// CN = users、DC = company、DC = ltm、DC = domのようにIPアドレスなしでパスを定義する必要があると思いますが、私は.NETで使用されていないため、はっきりとは言えません。

于 2010-01-22T09:50:17.913 に答える