locked
Active Directory RRS feed

  • Question

  • User-871389139 posted

    Hi All,I developed active directory authentication application in windows xp and iis 5.0.when i deployed in windows 2003 and iis 6.0 ,the authentication failed.

    Can someone suggest what will be the problem?

    Wednesday, April 8, 2009 10:42 AM

All replies

  • User-782232518 posted

    That depends on how your application do authentication. Do you have an error page or error message?

    Wednesday, April 8, 2009 10:12 PM
  • User-871389139 posted

    Dim adPath As String = LDAP://ad3-kk.bbb.com/DC=bbb,DC=com

    Dim adAuth As New LdapAuthentication(adPath)

     If adAuth.IsAuthenticated(strDomain, txtUserName.Text, txtPassword.Text) = True Then

    Session("UserID") = txtUserName.Text

    Response.Redirect("WelCome.aspx")

    Else

    lblError.Text = "Authentication failed, check username and password."

    End If

    If adAuth.IsAuthenticated(strDomain, txtUserName.Text, txtPassword.Text) = True Then

    Session("UserID") = txtUserName.Text

    Response.Redirect("WelCome.aspx")

    Else

    lblError.Text = "Authentication failed, check username and password."

    End If

    Public Function IsAuthenticated(ByVal domain As String, ByVal username As String, ByVal pwd As String) As Boolean

    Dim domainAndUsername As String = (domain & "\") + username

    Dim entry As New DirectoryEntry(_path, domainAndUsername, pwd)

    ' Dim strDept As String

    Try

    ' Bind to the native AdsObject to force authentication.

    Dim obj As Object = entry.NativeObject

    Dim search As New DirectorySearcher(entry)

    search.Filter = "(SAMAccountName=" & username & ")"

    search.PropertiesToLoad.Add("cn")

    search.PropertiesToLoad.Add("mail")

    search.PropertiesToLoad.Add("Company")

    search.PropertiesToLoad.Add("Department")

    Dim result As SearchResult = search.FindOne()

    If result.Properties.Values Is Nothing Then

    Return False

    Else

    Return True

    End If

    End try

    End Function

    the above is my code and it works fine with iis 5.1 but not in 6.0.i would really appreciate your help

    Thursday, April 9, 2009 4:47 AM
  • User-782232518 posted

    I guess that problem you met is this function returns false always. Am I right? If so, you can add some tracing code to see where comes the false value. If there is any exception raised, we may move on to that.

    Thursday, April 9, 2009 11:26 PM