Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

Too many page 'redirects'?

$
0
0
Hello

I have a simple 'new user registration' form that successfully inserts a username, password, and email address into a MS Access 2003 database. However, I seem to have confused page redirections, and IE just hangs after I press the form's 'submit' button. Safari tells me there are too many page 'redirects'.

Basically, after pressing 'submit' the user should be redirected to a page called success.asp - and that's it. But he is not.

There are two files: Register1.asp and success.asp.

Register1.asp, stripped of HTML, looks like this:

Code:

<%
username = ""
password = ""
confirmPassword = ""
strEmail = ""
ErrorMessage = ""

if request.form <> "" then
username = Request.Form("username")
password = Request.Form("password")
confirmPassword = Request.Form("confirmPassword")
strEmail = Request.Form("strEmail")

  if strEmail="" or password="" then
    ErrorMessage = "You must specify both email and password."
  end if
  if password <> confirmPassword then
    ErrorMessage = "Password and confirmation do not match."
  end if

  if ErrorMessage = "" then
    set conn = Server.CreateObject("ADODB.Connection")

 conn.Provider = "Microsoft.Jet.OLEDB.4.0"

 conn.Open("E:\myDatabase.mdb")

    set rs = Server.CreateObject("ADODB.recordset")
    rs.Open "Select * FROM userlist WHERE strEmail = '" & strEmail & "'", conn
    'if rs.EOF = true then     

sql="INSERT INTO userlist ([username], [password], strEmail) VALUES ('" & username & "','" & password & "', '" & strEmail & "')"
     
conn.Execute(sql)

      Response.Redirect("success.asp")
    else
      ErrorMessage = "Password and confirmation do not match."
    'end if
  end if
end if

if ErrorMessage <> "" then
  response.write("<p>" & ErrorMessage & "</p>")
  response.write("<p>Please correct the errors and try again.</p>")
end if
%>

while success.asp, again stripped of HTML, looks like this:

Code:

<%

If Session( "final" ) = true Then
%>
      <b><a href="dimaHome.html">LOGOUT</a></b>
             
            [ <% = Session( "user" ) %> ]
                 
              <B>Successfully added to the database</B></font>
<%
Else
Session( "loginfailure" ) = False
Session( "final" ) = false 
Call Response.Redirect( "success.asp" )       
End If
%>

Where am I going wrong, please?

Thank you.

Blue

Viewing all articles
Browse latest Browse all 688

Trending Articles