Prevent browser from caching

  • Thread starter Thread starter Shardul Kulkarni
  • Start date Start date
S

Shardul Kulkarni

Hi All,

What is the most reliable method of preventing a page from being cached by
the browser? I'm using ASP.NET v1.1.

Thanks.
Shardul.
 
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
 
Steve said:
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

Unless you really need "Cache-Control: no-store", I would prefer the
shorter
Response.Cache.SetCacheability(HttpCacheability.NoCache);
which is equivalent to the cache directive
<%@ OutputCache Location="None" %>


Cheers,
 
Back
Top