Redirect Back

Results 1 to 3 of 3

Thread: Redirect Back

  1. #1
    Join Date
    Dec 1969

    Default Redirect Back

    I have an ASP Form Processing script that is used about 60 times around my site. The script takes a few variables and throws them in a table. What I want to do is at the end of my script redirect back to the page that my vistor was just at. Is there an easy way to do this? Response.Redirect Back????<BR><BR>NOTE: the actual form is in an include file on every page, so adding a field to the form with the page name isn&#039t a possible solution. I hope this question made sense!?

  2. #2
    Join Date
    Dec 1969

    Default RE: Redirect Back

    Response.Redirect(Request.ServerVariables("HTTP_RE FERER")) should do the trick.<BR><BR>Dunc

  3. #3
    Josh Rolfe Guest

    Default RE: Redirect Back

    If the response.redirect thing doesn&#039t work, you could always pass an extra variable to the second page that acts as a flag. Then if you want the visitor to be redirected back to where they came from you you combine your asp with some javascript, like this:<BR>&#060;%If request("flag")=-1 Then%&#062;<BR> &#060;script&#062;window.history.go(-1)&#060;script&#062;<BR>&#060;%End If%&#062;<BR>This is a little different than using response.redirect. Since it is the same thing as clicking the back button once, it will usually not reload the page they came from again. This makes it a little quicker and is especially useful if the user has entered information into a form, since it will keep the information there (unless you don&#039t want that.)<BR>Or, if this page will ALWAYS be sending them back one, you don&#039t need the flag and the if statement, just use the script to send them back.

Posting Permissions

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