2010-01-22 3 views
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(); 

코드는 COMException을 생성합니다 : "잘못된 DN 구문을"dir.Properties에서 [ "설명"] 값LDAP 잘못된는 DN 구문

을 내가 사용자 이름과 암호를 지정할과 교체하지 마십시오. 로하여 DirectoryEntry 초기화 :

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

은 그 때 나는 CommitChanges에서 UnauthorizedAccessException를 얻을.

무엇이 잘못 되었습니까에 대한 아이디어는 크게 감사하겠습니다.

답변

1

AuthenticationTypes 지정하지 않고 사용해 보셨습니까?

DirectoryEntry dir = new DirectoryEntry(path, admin, pass); 
+0

예를하지만 나는이 컴퓨터에 연결된 장치가 작동하지 않는 나에게 알려주는 DirectoryServicesCOMException 얻을 :

그냥 좋아합니다. – remdao

+0

@remdao, 귀하의 컴퓨터가 해당 도메인에 가입되어 있습니까? – Regent

+0

내가 주장하는 컴퓨터에는 도메인이 없습니다. 그게 문제라고 생각합니다. 감사합니다. – remdao

0

비밀번호와 사용자 이름없이 로그인하려고하면 UnauthorizedAccess가 발생합니다.

이것은 실제로 LDAP 서버가 구성된 방법에 따라 다르지만 익명 액세스를 허용하지 않는 것 같습니다.

LDAP와 같은 IP 주소없이 경로를 정의해야한다고 생각합니다. // CN = 사용자, DC = 회사, DC = ltm, DC = dom하지만 .NET에서 사용되지는 않았습니다. 물론.