in .NET Framework

A way around page refreshes/back button problems with a simple concept

The problem:

You have a form in which the user fills out and clicks a “submit” button that validates their input, does some processing and output’s some results. The problem being the application needs to cater for page refreshes, back buttons and the case of the page being submitted more than once (latency/slow internet connection).

The Solution:

Possible solutions can be (this assumes not using Ajax as a solution), once the user clicks the submit button the server validates the user’s input and has processed the information. Store a unique id in session and redirect to a “complete” page. If the user clicks the back button and resubmits the page, you can build logic to check if a unique id exists in session and if it does, redirect to the complete page without having to re-process the information.

If the user is on the complete page and refreshes the page, because its on a page which has used a GET, there is no processing done and hence no duplication of data.

References:

http://en.wikipedia.org/wiki/Post/Redirect/Get

http://stackoverflow.com/questions/665399/how-do-i-stop-the-back-and-refresh-buttons-from-resubmitting-my-form