Hi,

I am trying to validate if a user is a member of a group.
Code:

 Dim sdomain As String = "CN=UserGroup,OU=Distribution,OU=Groups,OU=Corporate,OU=Vendor,OU=Portfolios,DC=Company,DC=local"

        Dim result As String = ""
        result = ValidateActiveDirectoryLogin(sdomain, txtUsername.Text, txtPassword.Text)



    Public Function ValidateActiveDirectoryLogin(ByVal sDomain As String, ByVal sUserName As String, ByVal sPassword As String) As Boolean

        Dim bSuccess As Boolean = False
        Dim adEntry As New System.DirectoryServices.DirectoryEntry("LDAP://" & sDomain, sUserName, sPassword)
        Dim adSearcher As New System.DirectoryServices.DirectorySearcher(adEntry)
        adSearcher.SearchScope = DirectoryServices.SearchScope.Subtree
        Try
            Dim adResults As System.DirectoryServices.SearchResult = adSearcher.FindOne
            bSuccess = Not (adResults Is Nothing)
            Me.Opacity = 0%
            frmMain.Show()
            Me.Close()

        Catch ex As Exception
            bSuccess = False
            MsgBox("Error: Username or Password is incorrect" & vbCrLf & "Please try again!", vbCritical, "Access Denied")
        End Try

        Return bSuccess
    End Function
The issue is, the function validates that the User and ID are valid Domain accounts. But I would like to validate that it is also a member of the group called "UserGroup". This is not working.