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: , , ,



One Response to “System.DirectoryEntry Unknown error (0×80005000)”

  1. Ben SWITZERLAND Windows XP Opera 9.25 Says:

    Hello Barry

    This helped me as lot. Thank you! I storm-clicked some banners for reward.

    Best regards.

Leave a Reply