1

I'm having a problem where IIS is sending the max age for .aspx pages which is causing all kinds of weirdness in our application. The original goal was to enable caching for static content but we noticed that our ASPX pages were also being cached which we don't want. I enabled the caching months back and don't remember exactly how I set it up.

Here are some things I've tried.

  • I have adjusted the Common Headers for the site in question and disabled Expire Web Content.
  • I had found a max-age set in the applicationHost.config file on the httpCompression node. Removing it however didn't stop it from being set.
  • I created a new website on the same web server with a sample page and it is also sending the max-age so it feels like a global setting somewhere.

I'm verifying the max-age and the page being loaded from cache using Chrome's Dev Tools and the network tab. The initial page load is a fresh copy and if I click a link on the page that takes me back to the same page I'm already on this load is from Cache.

3 Answers3

0

I was able to find the culprit that was sending the max-age value. It was set in the appplicationHost.config file in the httpCompression node. I had made the change directly in the config file but due to it being a locked file the edit would not apply. I then found it by editing the config in IIS Manager under the same node. Once I removed the value I restarted the application pool for my site and the max-age is no longer being sent.

0

It's a known bug of microsoft, please follow the discussion here:
IIS7.5 max-age issue(asp.net mvc output cache)

and in github:
https://github.com/Microsoft/dotnet/issues/330

Offir
  • 3,252
  • 3
  • 41
  • 73
-1

For some reason removing the entries in applicationHost.config changed nothing for me. I worked around the issue by adding the following to our web.config:

<staticContent>
  <clientCache cacheControlMode="NoControl" />
</staticContent>

as we are adding these headers anyway and it seemed to solve the issue.

Quibblesome
  • 25,225
  • 10
  • 61
  • 100