Last post Jul 14, 2005 01:04 PM by dunnry
Jul 13, 2005 11:43 AM|vishal_7|LINK
is it possible to specify a username and password inside the LDAP path AND the OU ? I have tried several methods but it doesnt work at all. I tried to enter the username/pw in the DirectoryEntry constr. but when I then specify the OU in the path, then I get:
The specified Domain either does not exist or could not be contacted. The code is something like this:
Dim entry As DirectoryEntry = New DirectoryEntry("LDAP://domain", "domain\username", "pw")
Dim strOU As String = "stores"
entry.Username = "domain\username"
entry.Password = "pw"
entry.Path = "LDAP://OU=" & strOU & ",DC=domain,DC=local"
Dim searcher As DirectorySearcher = New DirectorySearcher(entry)
Dim searchResult As SearchResult
Dim mySearchResultColl As SearchResultCollection
Dim myResultPropColl As ResultPropertyCollection
searcher.Filter = ("(&(objectClass=user))")
mySearchResultColl = searcher.FindAll()
If I remove the path line then I can get all users, but I need the one in the OU. Any help is appreciated.
Jul 13, 2005 03:19 PM|vishal_7|LINK
Jul 14, 2005 01:04 PM|dunnry|LINK