In Asp.net, after the form is submitted, the solution against refresh and repeated submission and anti-rollback

Source: Internet
Author: User

To avoid repeated operations, Refresh after the operation is indeed a common problem. After checking the information, we found that there was a very simple solution to this problem.

In Asp.net, form submission is generally in an event. After submission, some successful information is displayed in a friendly manner and then redirected to a page (possibly the original submission page, may be other pages ). Add response. Write ("<SCRIPT> alert ('success (or other message you want )! '); Window. Location. href = 'done. aspx'; </SCRIPT>!

Effect of refreshing: refresh done. aspx, which is equivalent to entering the page for the first time and does not submit forms repeatedly;

Effect of the backend: javascript receives events. After the alert information is displayed, the done. ASPX page is displayed again, and the form is not submitted repeatedly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.