No Cache Question

lorena

Centurion
Joined
Oct 23, 2003
Messages
134
Location
Phoenix, Arizona
I have a form and once the user submits it, I have the submit button no longer visible but if the user hits the back button on the browser, the form with all its information is still there. I have tried a variety of things to get the page to expire when the user hits the back button.
Right now, the code at the top of the .aspx page looks like this:
Visual Basic:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="premConv.aspx.vb" Inherits="webforms.premConv"%>
<%@ OutputCache Location="None" VaryByParam="None" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
		<META HTTP-EQUIV="Expires" CONTENT="-1">
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		
	</HEAD>
Testing the form, it submits and when I hit the back button on the browser, the original form is there. If I try to hit the forward button, IE tells me the page has expired but I can still hit the back button from there and see the form again.
What else do I need to do?
Thanks for any help.
 
The back button is such a pain in arse!!!

I have worked around this in the past a couple of ways ... both ugly but seem to work pretty well.

1. Force a forward on the body's onload event. (ok, so I was desperate)
<body onload="history.forward();">
2. Dynamically create all your elements via the code behind. If you don't have to allow them edit what they have just submitted.

Hope this helps, or atleast points you in somewhat of a direction.
 
Thanks for that - I hadn't heard of <body onload> before
I also found this code which works pretty well -
Visual Basic:
<%@ OutputCache Location="None" VaryByParam="None" %>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
If the user presses the back button, they still see the webform but it has no information. Then, if they press the forward button, they get "Page Expired" - so it mostly works.
 
Back
Top