Barry Dobson

RSS

System.DirectoryEntry Unknown error (0×80005000)

I have recently encountered this really unhelpful error message in VB.Net whilst trying to code a connection to an LDAP server. After much head banging I found the solution! It’s all down to the path you supply to the constructor: Old Connection (doesn’t work):

Using dir As New DirectoryEntry(ldap://yourserver:port)
	' Your Code
End Using
New Connection (does work):
Using dir As New DirectoryEntry(LDAP://yourserver:port)
	' Your Code
End Using
Spot the difference? That’s right! the protocol part (LDAP) is case sensitive. Changing to uppercase works like a charm. Update: I have posted an article and sample code on working with LDAP here.

Technorati Tags: , , ,