I have an asp.net application and when I refresh a web page which is produced after a form is submitted.
Example:
<form name="myform" action="mypage.aspx" method="post">
then the following alert is shown.
“The page cannot be refreshed without resending the information.
Click Retry to Send the information again,
or click Cancel to return to the page that you were trying to view.”
With two buttons:
Retry Cancel
How can I avoid the above alert and take “Cancel” as default & refresh immediately?
Thank you
Jeff
You should use the “Redirect-After-Post” pattern. Google for more info. But basically on form submission your server sends a redirect response to the client, which then fetches this page. This is the best practice for avoiding the issue you are seeing: you don’t get that annoying message on page refresh, the back button is not “broken” and it prevents accidental double submission. Really every form on your site should implement this pattern.
Here are a couple of questions on implementing it in asp.net:
How to use ASP.NET with "Redirect after POST" pattern? [Edited]
Redirect After Post in ASP.NET MVC