ASP login script

Results 1 to 3 of 3

Thread: ASP login script

  1. #1
    Charles Guest

    Default ASP login script

    I&#039m trying create a login page for my web use. However the script didn&#039t seem to work, any can help look at my code ?<BR><BR>When user come to my page, they will be prompted to login(default.htm), than the LoginID and password is passed to "login.asp" which the code is below. When is LoginID and password match the DB, they will be directed to "ok.htm", and "error.htm" when failed. Hhowever whenever I have the LoginID & password correct i&#039m still directed to "error.htm"<BR><BR>You can visit my site at There is also a access db with 1 user at<BR><BR>&#060;%<BR>Function Login(LoginID, Password)<BR><BR>Dim cn<BR>Dim rs<BR>Dim strSQL<BR>Dim strCn<BR><BR> Set cn = CreateObject("ADODB.Connection")<BR> Set rs = CreateObject("ADODB.Recordset")<BR><BR><BR>strSQL = "SELECT * FROM tblLogin WHERE LoginName = &#039"<BR>strSQL = strSQL & LoginID & "&#039"<BR><BR>On Error Resume Next<BR><BR> cn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=test.mdb"<BR><BR> cn.Open<BR> If Err Then Exit Function<BR><BR> rs.Open strSQL, cn<BR> If Err Then Exit Function<BR><BR> If rs.fields("PWD") = Password Then<BR> Login = True<BR><BR>Else<BR> Login = False<BR> <BR> End If<BR> rs.Close<BR> cn.Close<BR> <BR> Exit Function<BR>End Function<BR><BR><BR>If Login(Request.Form("LoginID"),Request.Form("PWD")) Then<BR> Response.Redirect "ok.htm"<BR><BR>Else<BR> Response.Redirect "error.htm"<BR>End If<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: ASP login script

    Did you try<BR><BR>If Login= True Then<BR>Response.Redirect "ok.htm"<BR><BR>Else<BR>Response.Redirect "error.htm"<BR>End If<BR>

  3. #3
    Charles Guest

    Default RE: ASP login script

    Yes, it didn&#039t work....btw, is my DSN string correct ?

Posting Permissions

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