views:

36

answers:

1

We enabled static resource caching in our ASP.NET application like this:

<system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseExpires" httpExpires="Thu, 29 Oct 2020 00:00:00 GMT" />
    </staticContent>
  </system.webServer>

Using a sniffer, we can confirm that the Expires tag is actually being placed on the respose's header.

However, the browsers insist on requesting the server to check whether the resource has changed or not. The server returns a not modified code (304). This is, indeed, a very light weight request but we're highly concerned about performance so we'd like to save theses requests.

How can I tell the brosers they shouldn't even request the server?

PS: ETags are properly being sent to the client. I thought that if I removed them the browsers could somehow stop requesting the server but I couldn't remove these tags on IIS 7. I don't know if it would help anyway.

+1  A: 

Something's not adding up, what you've described should be sufficient for eliminating the If-Modified-Since/304 behavior. Can you include all response headers, so we can have a closer look?

Also, note that hitting 'Refresh' would cause what you've described - what you should be testing is an actual link to the page in question.

FYI, I posted a similar question a while ago (1), except that I was seeing the opposite: the normal If-None-Match/304 interaction was optimized away by the browser (in the same session).

(1) http://stackoverflow.com/questions/1948727/etags-iis7-kernel-cache-policy-enablekernelcache

Nariman
Thanks Nariman. Before posting response headers, I'll test the 'link to the page' as you described. I'm hitting F5. I don't know how I didn't think of that before, it makes sense. I'll test and come back to you.
Ciwee
That must be it.
Nariman