asp.net processing F5 refresh page repeat submit page of an idea
- 2020-05-09 18:23:11
- OfStack
After submitting a page, if we click F5 again to refresh the page, a prompt will pop up, reminding us that if we continue, we will re-submit the content we just submitted. If it is similar to payment or one-time operation, we should not do this, otherwise it will cause the problem of repeated submission. To solve this problem, we can deal with it as follows:
1. Upon successful submission, put a success state into session and reload the page.
2. In the page_load method, determine the status value of the session field. If it is successful, display the success information; otherwise, display the error message, and then clear the cache with the Session.Remove () method.
1. Upon successful submission, put a success state into session and reload the page.
2. In the page_load method, determine the status value of the session field. If it is successful, display the success information; otherwise, display the error message, and then clear the cache with the Session.Remove () method.