(Yes, an easy one for the experts)
How do I force the page to refresh when the user hits the back button on the browser? I have an 'add' record form and I have inserted code so that it will not duplicate if the user submits the form several times however I just discovered that if the user goes forward then back and submits again it will create a new record. I want it to display the 'page expired' message.
???
I think there is a setting in IIS that you can use for that...
If you go to Web Site Properties, Http Headers tab, you can set the Enable Content Expiration in there...
Was this answer helpful ?
Yes No
I updated 'content expiration' to 'immediately' and it doesn't seem to have made any difference?
Was this answer helpful ?
Yes No
Maybe stop and start the web site to make sure it has the new settings??
Was this answer helpful ?
Yes No
Hi q97, I stopped and re-started IIS... still did nothing. I ended up using the following code in the header of pages:
Code:
<%
Response.AddHeader "Expires", now()
Response.AddHeader "Last-Modified", now()
Response.AddHeader "Cache-Control", "no-cache, must-revalidate"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<script>
history.forward();
</script>
(I use Dreamweaver templates, so it only took a few seconds to implement).
It now appears that the 'back' button is disabled; and if that doesn't work the content will be refreshed!
It wasn't what I was originally trying to do but I think this method is probably better in the long run. It's only for 'admin' users so I can add some explanation in my help/FAQ documentation.
Thanks for your post anyway!
Was this answer helpful ?
Yes No
As long as it works!
I might even try using some cache control in my page as well...didn't think of it to be honest.
Was this answer helpful ?
Yes No