Prevent Form Re-Submission on Page Refresh


/ Published in: ASP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. 'Use a hidden form field "RedirectAfterSubmission" with the URL in it as a value:
  2. 'For example: Request.ServerVariables("URL")
  3. 'As soon as post form data is received and processed (stored in cookies, DB etc.),
  4. 'use the following:
  5.  
  6. <%
  7. Response.Redirect(Request.Form("RedirectAfterSubmission"))
  8. %>
  9.  
  10. 'As a result page will be RE-requested by GET method instead of POST
  11. 'and refreshing the page won't cause it to re-submit the data!

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.