Pragma no-cache

I had a requirement where an aspx page should not be cached in the Temporary Internet Files, simply because we want to reload the page from the server each time. This sort of scenario may present when login or authenticating. Some research and I found this article http://support.microsoft.com/kb/222064.

I was writing code in .Net and luckily its even simpler. Simply add this to the Page_Load

Response.Cache.SetCacheability(HttpCacheability.NoCache);
 Response.AddHeader(“Pragma”, “no-cache”);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: