Disable client caching of for aspx pages to prevent pages from being modified

  • 2020-05-26 08:08:57
  • OfStack

By default, IE opens a web page and caches it locally in order to reduce the number of visits to the server and improve performance. However, sometimes this also brings us some disadvantages, such as the modified information page, after submitting the modification, we will open the secondary page again, because URL has not changed, so IE will read the local cache, and the page will still display the original information, which is particularly easy to appear in the popup dialog box or window to modify the format.
In ASP.NET you can add the following to the page:
 
<%@ OutputCache Location="None" VaryByParam="None" %> 

or
Put in the HEAD section of HTML
 
<!-- Disable the cache section to start --> 
<meta http-equiv="Expires" content="0" /> 
<meta http-equiv="Progma" content="no-cache" /> 
<meta http-equiv="cache-control" content="no-cache,must-revalidate" /> 
<!-- Disable the end of the cache section --> 

Related articles: