/// <Summary>
/// Set the page not to be cached
/// </Summary>
Private void SetPageNoCache ()
{
Response. Buffer = true;
Response. ExpiresAbsolute = System. DateTime. Now. AddSeconds (-1 );
Response. Expires = 0;
Response. CacheControl = "no-cache ";
Response. AppendHeader ("Pragma", "No-Cache ");
}
1. Cancel Cache
(2) Client Cancellation
<Html>
<Head>
<Meta http-equiv = "Expires" CONTENT = "0">
<Meta http-equiv = "Cache-Control" CONTENT = "no-cache">
<Meta http-equiv = "Pragma" CONTENT = "no-cache">
</Head>
(3) Cancellation of service appliance:
Server:
Response. Buffer = true;
Response. ExpiresAbsolute = DateTime. Now. AddDays (-1 );
Response. Cache. SetExpires (DateTime. Now. AddDays (-1 ));
Response. Expires = 0;
Response. CacheControl = "no-cache ";
Response. Cache. SetNoStore ();
In Global:
Protected void Application_BeginRequest (Object sender, EventArgs e)
{
HttpContext. Current. Response. Cache. SetNoStore ();
}
<% @ OutPutCache Location = "None" %>
Page Base class:
Public class PageBase: Page
{
Public PageBase (){}
Protected override OnLoad (EventArgs e ){
Response. Cache. SetNoStore ();
Base. OnLoad ();
}
}
The simplest method is :-)
To learn about CSDN, add some useless parameters randomly after the URL, for example:
Http: // xxx/xxx.jpg? P = xxx
IE uses URLs to control the cache.