How to prevent web page caching across all browsers

HTTP Headers

There are two main types of cache headers, Cache-Control  and Expires . They define the caching characteristics of your resources. Typically, Cache-Control  is a better approach than Expires , however, both headers can be used simultaneously.

Cache headers are applied to resources at the server level, for example, in the .htaccess of an Apache server.

If you don’t want pages to be cached by the web browser, the minimum set of headers that work for most browsers and proxies are:

Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

Cache-Control is for browsers and proxies using the HTTP/1.1 protocol.

Pragma  is for old browsers using the HTTP/1.0 protocol

Expires is for browsers and proxies, although in HTTP/1.1 Cache-Control takes precedence over Expires .

You can set the response headers for a page served over a HTTP connection.

Classic ASP

Response.addHeader "Cache-Control", "no-cache, no-store, must-revalidate"
Response.addHeader "Pragma", "no-cache"
Response.addHeader "Expires", "0"


response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "0");


header("Cache-Control: no-cache, no-store, must-revalidate"); 
header("Pragma: no-cache");
header("Expires: 0");


<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0

IIS web.config

            <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
            <add name="Pragma" value="no-cache" />
            <add name="Expires" value="0" />