Avoiding "page cannot be displayed" with no cache on IE6

  • Thread starter Thread starter Bill Faulk
  • Start date Start date
B

Bill Faulk

I want to avoid letting users use the back button on forms with multiple
postbacks so I use Response.Cache.SetNoStore() for these pages. This works
fine for IE7 and Firefox by showing the desired "this page is expired"
message for those browsers. IE6 just shows a "the page cannot be displayed"
error.

Is there any way to avoid the error for IE6 and just show the page as
expired when the user presses the back button?

If there's any client setting, web.config setting (browserCaps?), or coding
to get this to work please let me know.

As a simple test, here's a sample from the documentation that demonstrated
what I see. Press submit a few times and then use the back button.

<%@ Page language="c#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HttpCachePolicy - SetNoStore - C# Example</title>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
// Prevent the browser from caching the ASPX page
Response.Cache.SetNoStore();

// Display the DateTime value.
Label1.Text = DateTime.Now.ToLongTimeString();
}
</script>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>HttpCachePolicy - SetNoStore - C# Example</h3>

<p>Click the Submit button a few times, and then click the Browser's
Back button.<br />
You should get a "Warning: Page has Expired" error message.</p>

<p>Time: <asp:Label id="Label1" runat="server" Font-Bold="True"
ForeColor="Red" /></p>

<asp:Button id="Button1" runat="server" Text="Submit" />
</form>
</body>
</html>
 
don't post to so many newsgroups, folks usually avoid answering those types
of post. Have a look at the setcacheability enum (or some name similar to
this), set it to none. That should work.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
https://www.microsoft.com/MSPress/books/10933.aspx
OWC Black Book www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
 
Back
Top