Author: sirmoreno | Posted on: 11/25/2008 7:41:05 AM | Views : 342

Hi,

I'm trying to disable the browser cache. my code is:

HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1))
HttpContext.Current.Response.Cache.SetValidUntilExpires(False)
HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)

HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)

HttpContext.Current.Response.Cache.SetNoStore()

This code works when I tryed it on a new web site I created.

But  I have an existing web site where this code has no effect, and I don't have any Idea why.

When the code works I get the Response Headers:

      Cache-Control no-cache, no-store, must-revalidate Pragma no-cache Expires-1

 When the code doesn't work the Response Headers:

  & ...

Go to the complete details ...