Forums Register Login

session cahe

+Pie Number of slices to send: Send
Is it possible to prevent the user from loading a page that has been cached when the browser is refreshed.
This is the code in my page:
<% response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.addDateHeader("Expires", 0); %>
But when the user hits refresh it still loads the form that was there. The biggest problem is that the browser actually tells you to do this.
browser info:
Warning, Page has expired
..........
To resubmit your information and view this Web page, click the Refresh button.

Any help would be appreciated.
Sam Anjos
+Pie Number of slices to send: Send
Sam,
I also faced this problem & I used sessions to resolve this.If you want to prevent page to refresh,its better you create a session or use setAttribute() from previous page..& in original page check the session or getattribute() for the first time & display the contents & make it null at the end.Now if you refresh do whatever action you want coz session is null now
the pseudocode should look like this
if(request.getAttribute("someObj")!= null)
{
//show whatever u want for first time
request.setAttribute("someObj")=null
}
else
{
response.redirect("tosomepage")
//or do whatever action u want here to prevent refresh
}
Try this it will work

njoi
What does a metric clock look like? I bet it is nothing like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1311 times.
Similar Threads
problem using html:link
Session Tracking
Re-login issue after click on browsers back button and press refresh
Disabling Back and Refresh/Reload button.
Warning: Page has Expired
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:30:07.