View Full Version : Error querying LDAP

03-08-2007, 02:30 AM

I usually only participate in the C/C++ forum but i guess desperate times need desperate measures.

Well, i am trying to query an LDAP through DirectoryServices but can't seem to get it right and need ur help in the matter.

Here's the code i am using..

strUID = Request.ServerVariables("HTTP_UID")

Dim Entry As System.DirectoryServices.DirectoryEntry
Entry = New DirectoryEntryldap://myserver:401/ou=people,o=org, "uid=myid,o=org", "pwd123")
Dim Search As DirectorySearcher = New DirectorySearcher(Entry)
Search.Filter = "(micid=" & strUID & ")"
Dim Results As SearchResult = Search.FindOne()
strfname = Results.Properties("givenname")(0).ToString()

The error i am getting is :
The parameter is incorrect.

I got a hunch that the user id i am using i.e uid=myid,o=org
is the cause of the problem as the server is taking it as more than one parameter.
But don't know how to fix it..

Can anybody help..??

Thanks a lot..


"Have no fear of perfection, you'll never reach it"

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum