ASP Login Page - Not matching up with Access table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jerrydigital
    New Member
    • Oct 2008
    • 67

    ASP Login Page - Not matching up with Access table

    Hello,

    I have created a login.asp page which i have posted below. When I login into my site, it automatically takes me to the redirect page "index.html " which means that i entered the wrong login information.

    I believe i am not connecting to the access table correctly.

    Here are some of the characters I used(hope this helps clear up my asp page)

    Email --- this is the title to the login column in my access table
    Password --- password column title in my table
    email --- this is the "name" for the email input text box
    password --- this is the "name" for the password input text box
    dsn --- access_registra tion_db.dsn
    Access database --- registration.md b
    tablename --- tblRegister

    Any thoughts on where I went wrong? Thanks

    Code:
    <%
    Function Login(Email, Password)
    
    Dim cn
    Dim rs
    Dim strSQL
    Dim strCn
    
    Set cn = CreateObject("ADODB.Connection")
    Set rs = CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM tblRegister WHERE EmailName = '"
    strSQL = strSQL & Email & "'"
    
    On Error Resume Next
    cn.ConnectionString = "DSN=access_registration_db.dsn" & Application("registration.mdb")
    
    cn.Open
    If Err Then Exit Function
    
    rs.Open strSQL, cn
    If Err Then Exit Function
    If rs("password") = Password Then
    Login = True
    Else
    Login = False
    End If
    rs.Close
    cn.Close
    Exit Function
    End Function
    
    If Login(Request.Form("email"), Request.Form("password")) Then
    Response.REdirect "accountpage.html"
    Else
    Response.Redirect "index.html"
    End If
    %>
  • jerrydigital
    New Member
    • Oct 2008
    • 67

    #2
    sorry for this question, i figured it out. If there is a way to delete my post when i ask a question i figure out before someone else posts, please let me know.

    Comment

    • DrBunchman
      Recognized Expert Contributor
      • Jan 2008
      • 979

      #3
      Hi Jerry,

      Moderators can delete posts but if you've answered your own question it's usually more helpful to reply to your post and let everyone know how you fixed it so that anybody else with the same problem can see how you did it.

      Glad you got it sorted,

      Dr B

      Comment

      • jerrydigital
        New Member
        • Oct 2008
        • 67

        #4
        Ok, thanks for your reply.

        I was way off on my code i posted above. At least I think i was.

        I found a better code to use in a book called Active Server Pages 3.0 By Example.

        Comment

        Working...