Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cache/Headers problem

Status
Not open for further replies.

BKQc

Programmer
Jul 26, 2002
118
CA
I have a web page for which I want to implement if-modified-since algorithm to minimize server and network load but it seems I have a big problem getting the last-modified header to get sent to the client.

Up to now, I've tried using response.cache.setLastModified([myDate]) and also response.appendHeader("last-modified", [mydate]) but in both cases, monitoring the network (wireshark or Fiddler) has proven the header to not appear.

By looking at the FW code with Reflector, I found that this may be related to the cacheability of the page which seems to be by default (in this application) equal to no-cache. So I tried setting it back to private with no success (which seems to be normal according to SetCacheability code).

So I'm now trying to find out why is my page starting with no-cache instead of public or private... As far as I went now, this could have something to do with System.Web.UI.PageInitOutputCache which sets this. Anyone has any suggestion?
 
BKQc,

Have you tried this on page load? I think you should be able to modify the code below to get what you want.
Code:
            Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D)
            Response.Expires = -1500
            Response.CacheControl = "no-cache"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top