Hi guys.,
Basically what i am trying to do is that to get the input from the user
and check to see if that user exist in a particular OU.
this code will return true if a user exist in an active directory.
Public Function validate1(ByVal UserName As String, ByVal pwd As
String)
Dim path As String = "LDAP://Domain/path"
Dim UsrName As String = "Domain\" & UserName
Dim authenticated As Boolean
Try
Dim authenticationEntry As DirectoryEntry = New DirectoryEntry
(path, UsrName, pwd)
Dim authenticatedName As String = authenticationEntry.Name
authenticationEntry.Close()
authenticated = True
Catch er As Exception
authenticated = False
End Try
Return authenticated
End Function
--> in the path i specified the OU and container
it supposed to return true if a user exist in that container. But for some
reason, it will also return true if the user exist in different container.
any idea what's going on?
thanks in advance