Mobile Project Development notes (Asp.net prevents repeated data submission due to page refreshing)

Source: Internet
Author: User

The project repeatedly adds an identical record to the database after refreshing. Cause error. The problem is as follows:

How does Asp.net prevent repeated data submission problems caused by PAGE refresh or rollback?:

In fact, Asp.net's prevention of refresh is a common problem in Asp.net development. There are usually many ways to achieve it: (the following are some solutions) not very comprehensive, and I hope my friends can add more. Thank you.

 

1.Request forwarding(After performing the update operation in the database, jump to another page immediately to prevent the page from refreshing and sending back ),

2.Reload the page(Use JavaScript to re-load the page after the operation is executed: <SCRIPT> window. Location = "Current page '</SCRIPT>)

3.Do not save Cache(That is, after the submission, the data in the form will not be cached and saved by the browser. If a refresh or backend request is received, the page will be displayed as "the webpage has expired ", the data will not be submitted repeatedly, which will prevent repeated submission refresh.

(See: http://www.cnblogs.com/zpq521/archive/2007/08/14/854631.html ))

4.A solution of msdn: It re-defines the system. web. UI. when a page class is used to load a page, it is a "refresh", "back" request, or a normal request. Other pages inherit the custom page class.

(See:Http://msdn.microsoft.com/zh-cn/library/ms379557 (vs.80). aspx)

 

Of course there may be other solutions,I hope my friends can propose their own solutions. Thank you.

 

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.