Hi
I have this piece of code that just check username and password against a Active directory. If I also would like to filter against a specific group name how would I then do?
Best Regards
I have this piece of code that just check username and password against a Active directory. If I also would like to filter against a specific group name how would I then do?
HTML:
Public Function ValidateActiveDirectoryLogin(ByVal Domain As String, ByVal Username As String, ByVal Password As String, ByVal GroupName As String) As Boolean
Dim Success As Boolean = False
Dim Entry As New System.DirectoryServices.DirectoryEntry("LDAP://192.168.0.1/DC=" & Domain, Username, Password)
Dim Searcher As New System.DirectoryServices.DirectorySearcher(Entry)
Searcher.SearchScope = DirectoryServices.SearchScope.Subtree
Try
Dim Results As System.DirectoryServices.SearchResult = Searcher.FindOne
Success = Not (Results Is Nothing)
Catch
Success = False
End Try
Return Success
End Function
Best Regards