quarta-feira, 7 de janeiro de 2009

.NET LDAP integration COMException (0x80005000): Unknown error (0x80005000)

Be carefull when working with DirectoryServices in .NET
The following exception:

Exception info:
[COMException (0x80005000): Unknown error (0x80005000)]

can be caused by specifying the LDAP Domain in lowercase when creating the DirectoryEntry:

wrong:
DirectoryEntry entry = new DirectoryEntry("ldap://ldap.myserver.com","domain\\user","pass");
correct:
DirectoryEntry entry = new DirectoryEntry("LDAP://ldap.myserver.com","domain\\user","pass");

Sem comentários:

Enviar um comentário