Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Prevent asp.net caching

I'm having trouble preventing caching on an ASP.NET application. It works mostly, but sometimes seems to fail.

I've got this code in the OnLoad():

Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Page.Response.Cache.SetNoServerCaching();

Is there something else I should be doing ?

SMJ
Monday, March 08, 2004

This is what I've found that works 100% of the time:

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.MinValue);

Brad Wilson (dotnetguy.techieswithcats.com)
Monday, March 08, 2004

Oh, and we don't use SetNoServerCaching() because we don't use server caching.

Brad Wilson (dotnetguy.techieswithcats.com)
Monday, March 08, 2004

Thanks Brad, I'll try that.

SMJ
Monday, March 08, 2004

*  Recent Topics

*  Fog Creek Home