ASP. NET rollback. Net prevents repeated submission after refresh

Source: Internet
Author: User

Original http://www.cnblogs.com/super-cj/archive/2012/11/07/2758472.html

Making webpages "obsolete immediately" is sometimes a very useful function, for example, preventing users from using backend services to destroyProgramLogic, the Program actively Refreshes a page, and so on. The most effective method in ASP is:

Response. cachecontrol = "no-Cache"

In this case, response. expires =-1 is not required or meets our requirements.
But in the ASP. NET era, when I am still confused about using this statement, I found that the response field in msdn is described as follows:

Sets the cache-control HTTP header to public or private.
[C #]
Public String cachecontrol {Get; set;} property value
"Public" or "private ".
Exceptions
Argumentexception: cachecontrol is an invalid Cache control value (not private or public ).

How can I only assign "public" and "private" values? However, one experiment knows that Ms is the publisher. As long as the HTTP Head Value of cache-control is valid, it is acceptable, including no-cache.
In addition, the functions of this method are still the same as those in ASP. Of course, it seems that. Net officially recommends this method:

Response. cache. setcacheability (system. Web. httpcacheability. nocache );

This effect is exactly the same as that of the former.
Finally, it seems that only IE is correct. Firefox does not buy this account ......

Simply Add the following sentence to page_load:

Response. cache. setcacheability (system. Web. httpcacheability. nocache );

The page will be prompted as long as the user moves back.

Related Article

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.