Solution to prevent repeated submission and rollback of webpage

Visual Design eight thousand one hundred and fifty-three 13 years ago (2011-04-27)

Method 1: Disable the submit button after submission (most people do this)

What if the customer presses F5 to refresh after submitting?

Method 2: Use Session

On the submitted page, that is data base Before processing

 If session ("ok")=true then response. write "Error, submitting" response. end if

After data processing, modify session ("ok")=false

Method 3. Redirect to another page immediately after data processing is successful

Refreshing after operation is really a problem. You can use jump page and close this page. If there are parameter data conditions to control it, it should be easy. You can directly modify the value of window.location and change all the parameters. That's enough.

Disadvantages: Simply use Response Redirect will no longer work, because when users go from one page to another, we must clear location.history with client code. Note that this method clears the last access history, not all access records. Click the Back button, and then click the Back button. You can see that the page before this page opens! (Of course, this is when your client has JavaScript enabled.)

What if the customer presses Back?

Method 3: Prevent the webpage from backing up -- disable caching

When we add a database, if we are allowed to back off, and the page happens to be refreshed, we will perform the addition again. No doubt this is not what we need. Like many online codes that prohibit caching, sometimes it is unreliable. At this time, you just need to add a new page to the operating page, and then click Back, See if you won't go back to the operation page just now. In fact, the history has been deleted
'''''''''''''''''''''''''''''''''''''''' ASP

 Response. Buffer = True    Response. ExpiresAbsolute = Now() - 1    Response. Expires = 0    Response. CacheControl = "no-cache"

////////////////////////////////////////ASP. NET

 Response. Buffer=true; Response. ExpiresAbsolute=DateTime. Now. AddSeconds(-1); Response. Expires=0; Response. CacheControl="no-cache";
 header('Expires: '.date('D,d M Y H:i:s',mktime(0,0,0,1,1,2000)).'  GMT');
header('Last-Modified:'.gmdate('D,d M Y H:i:s').' GMT');
header('Cache-control: private, no-cache,must-revalidate');
header('Pragma: no-cache');

How can I "disable" browser 's back button? Or "How can I prevent users from clicking the Back button to return to the previously viewed page?"

Unfortunately, we were unable to disable the browser's back button.

Method 4: Prevent the webpage from going back -- open a new window

Pop up the form page with, and click Submit to close the page; The submitted ASP page is also popped up. Set the target of the form, click window. open ("XXX. asp", "_blank") when submitting, and then use JS to submit the form. After that, window. close();
To put it simply, a new window pops up when the form is submitted and this window is closed. How to back up the window opened by window. open()? Where can I go back?