The project often encountered after the refresh of repeated to the database to add an identical record, resulting in duplication of data, how to circumvent these problems? Let's talk about how ASP can prevent the page from flushing or backing back from recurring data issues:
In fact, ASP. NET prevent refresh is a common problem in ASP. There are often several ways to do this: (The following are just some of the methods of personal summary), but also hope that friends can add a lot. Thank you.
1: Request Forwarding (that is, jump to another page immediately after the data commit operation to prevent the page refresh from causing the postback operation)
2: Do not save cache Response.Cache.SetNoStore (); (That is, the data on the form after submission is not saved by the browser's cache, if you encounter a refresh or back-up request at this time, it will show "page has expired", the data will not be repeated, this has prevented the refresh of duplicate submissions effect.)
A solution for 3:MSDN: It is when the page is loaded by redefining the System.Web.UI.Page class, is it a "refresh", "back" request, or a normal request, and the other pages inherit the custom page class
(See also: http://msdn.microsoft.com/zh-cn/library/ms379557 (vs.80). aspx)
Of course, there are other solutions, I hope friends to put forward their own solutions. Thank you.