This was a very frustrating error. I was able to connect to LDAP through LDAPadmin but not through a program I was creating. “The object does not exist” error occurs, at least in my experience when the credentials you are passing to the server do not authenticate.
In this case I was getting nowhere. Resorting to Wireshark, filtering against port 389, which is the port for LDAP resulted in me seeing a backslash in the credentials being passed as well as the username coming after the organization, which is wrong for my environment.
The resolution was to set the domain to nothing in VB or null in C# in my Net.NetworkCredential object. At the same time moving the organization to the username property.
Dim credLDAP As New Net.NetworkCredential(“cn=username”,”password”, “o=domain”)
does not work, but this does:
Dim credLDAP As New Net.NetworkCredential(“cn=username,o=domain”,”password”, nothing)