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 が発生します。
何が間違っているかについてのアイデアは大歓迎です。