To read the article online, visit

Rewiring the Back Button

By TJ Sylvester

Often there is a need for a form to "expire". Once a user submits a form, if they attempt to navigate back to the expired form (via the back button), they will instead be rerouted to an ASP page other than the expired form. Netscape supports a cache feature in the META tags to support this, but Internet Explorer does not. A simple work around is available for applications that must have this.

This article will not go into great detail of an application for this work around, but merely to steer you into the right direction.

The work around consists of four pages. The first page is the default page (default.asp). Often this is the page you would want your users to return to. default.asp will contain a simple hyperlink to the ASP page that contains the form you would like your users to fill out. default.asp might contain the following simple code:

<html> <head> <meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> </head> <body> <p>Opening Page</p> <p><a href="form.asp">Let's go to the form</a></p> </body> </html>

The second page, form.asp, would display the form to the user. This ASP page also needs to determine whether or not the user has returned to it from hitting the back button or not. If they have (that is, the user has already entered the form information once before, and the form has "expired"), then the user needs to be redirected to a different ASP page (default.asp in this example).

<%@ Language=VBScript %>
Response.Buffer = True

' sets header and footer
dim header, footer

header = "<HTML>" & VBCrLf
header = header & "<HEAD>"  & VBCrLf
header = header & "</HEAD>" & VBCrLf
header = header & "<BODY>" & VBCrLf

footer = "</BODY>" & VBCrLf
footer = footer & "</HTML>"

if NOT isEmpty(Request.Form("searchRequestSubmit")) then
	' process code and sub routines here

	' code to set session variable and redirect to confirm.asp
	Session("GoForward") = "True"
	Response.Redirect "redirect.asp"
	Response.Write header
	Response.Write "<form name=""searchRequest"" action=""form.asp"""
	Response.Write " method=""post"">" & VBCrLf
	Response.Write "<p>Please enter confirmation number</p>"
	Response.Write VBCrLf
	Response.Write "<input type=""text"" name=""searchCriteria"" "
	Response.Write "size=""5"">" & VBCrLf
	Response.Write "<input type=""submit"" value=""Search"" "
	Response.Write "name=""searchRequestSubmit"">" & VBCrLf
	Response.Write "</form>" & VBCrLf
	Response.Write footer
end if

Now that we've looked at how to create the first two pages, in Part 2 we'll look at how to create the remaining two pages!

  • Read Part 2

  • Article Information
    Article Title: Rewiring the Back Button
    Article Author: TJ Sylvester
    Published Date: Wednesday, January 26, 2000
    Article URL:

    Copyright 2017 QuinStreet Inc. All Rights Reserved.
    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers