I have two functions

Private Function AuthenticateUser() As Boolean
        Dim username = txtUN.Text
        Dim password = txtPW.Text
        'Dim domain As String = 'this can be in a config file, hard
coded (I wouldnt do that), or inputed from the UI
        Dim domain As String = "LDAP://XXX.ORG/
CN=DrugReports,OU=Application Access Groups,OU=Security Groups -
Global,DC=jmhosp,DC=org"
              Dim isAuthenticated As Boolean =
ValidateActiveDirectoryLogin(domain, username, password)
        Return isAuthenticated
    End Function

    Private Function ValidateActiveDirectoryLogin(ByVal Domain As
String, ByVal Username As String, ByVal Password As String) As Boolean
        Dim Success As Boolean = False
        Dim Entry As New System.DirectoryServices.DirectoryEntry
(Domain, Username, Password)
        Dim Searcher As New System.DirectoryServices.DirectorySearcher
(Entry)
        Searcher.SearchScope = DirectoryServices.SearchScope.OneLevel
        Try
            Dim Results As System.DirectoryServices.SearchResult =
Searcher.FindOne
            Success = Not (Results Is Nothing)
        Catch ex As Exception
            Success = False
        End Try
        Return Success
    End Function

I Know I am a member of this group but I cannot authenticate against
it.
If i Just  change the domain to XXX.ORG and get rid of all the
containers it authenticates fine however I want AD to control which
users can access the application

can someone help?

Reply via email to