Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Feb 2003
    Location
    DC Metro, District Of Columbia, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    asp login script

    I am trying to complete an asp login script which *simply* gets email address and password from a small form on login page; validates to an access db (seven db fields) and returns a recordset from the small db; then I can use the userlevel field to validate all visited pages via session(userlevel). To date: the DW MX template from a sams book and the DW MX online help does not produce a useable login script, too many errors; downloaded multiple scripts (canned) from asp sites with same results - errors that will not go away. The site is for sensitive information and must be restricted to the users we add to the db only, no online forms, a few pdfs to print and submit via snail mail or in person. The login page and include for other pages shoulda been easy to implement (frown). I have a new script I am trying - this one gives 500.100 error (expected 'end' - mskb says needs response.end; tried it here and there and .... So, I could use a simple, working login.asp script which reads my small db, or if requested, I will c&p current (grin) script to a response from this forum. TIA

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: asp login script

    It's probably easier to troubleshoot from what you already have than it will be for someone to produce a new login process for you. Go ahead and post what you already have and we can attempt to troubleshoot from there.

  3. #3
    Star Lounger
    Join Date
    Feb 2003
    Location
    DC Metro, District Of Columbia, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: asp login script

    Thank you Mark: BTW, the include is the path to the mdb, here is the code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    !--#include file="login-data.asp"--> REM have to snip '<' from comment / include line cuz this forum will not display comment lines ! Go Figure! <grin>.

    <%
    Response.Buffer = true
    %>

    <%
    If Request.Form("txtEmailAddress") <> "" AND Request.Form("txtPassword") <> "" Then

    '-- Declaring and initing variables
    Dim DataConnection, cmdDC, RecordSet, SQL, strError
    Dim strUserName, strPassword, strEmail, strUserID

    strPassword = Request.Form("txtPassword")
    strEmail = Request.Form("txtEmailAddress")

    '-- Create object and open database
    Set DataConnection = Server.CreateObject("ADODB.Connection")
    DataConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & DatabasePath & ";"

    Set cmdDC = Server.CreateObject("ADODB.Command")
    cmdDC.ActiveConnection = DataConnection

    '-- my SQL
    SQL = "SELECT * FROM tblUsers"

    If Request.Form("txtEmailAddress") <> "" Then

    SQL = "SELECT tblUsers.* FROM tblUsers WHERE tblUsers.password ='" & strPassword & "' AND tblUsers.emailaddress ='" & strEmailAddress & "'"

    End If

    cmdDC.CommandText = SQL
    Set RecordSet = Server.CreateObject("ADODB.Recordset")
    RecordSet.Open cmdDC, , 0, 2

    '-- set validate for all pages
    If Not RecordSet.EOF Then
    Dim strUserLevel
    strUserLevel = RecordSet.Fields("userlevel")
    Session("userlevel") = strUserLevel
    Else
    Response.Redirect("default.asp")
    End If

    '-- Closing all connections
    RecordSet.Close
    Set RecordSet = Nothing

    DataConnection.Close
    Set DataConnection = Nothing
    set cmdDC = nothing
    Response.End
    %>

    <html>
    <head>
    <title>Login Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>

    <form action="Nav Page.asp" method="post">
    <table border="2" width="80%">
    <th align="center" title="Please Log in."></th>
    <tr>
    <td> Enter Email Address:
    </td>
    <td>input type="text" name="txtEmailAddress" size="80" value="">
    </td>
    </tr>
    <tr>
    <td> Enter Password:
    </td>
    <td>input type="password" name="txtPassword" size="30" value="">
    </td>
    </tr>
    </table>
    <p align="center">
    <input type="submit" name="btnLogin" value="Login">
    </p>
    </form>

    </body>
    </html>

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: asp login script

    I'm not familiar with 500.100 errors, but there seems to be a missing End If for the very first If...Then statement. Does that help?

    Also, you might want to take a look at the article mentioned in <post#=398249>post 398249</post#> if your page is available to the public.

  5. #5
    Star Lounger
    Join Date
    Feb 2003
    Location
    DC Metro, District Of Columbia, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: asp login script

    Thank you for both the catch, ' What endif??? :^) ' and for the article. I have linked to it and will read it soon.
    jl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •