Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC Client Cache for Static content is not working

I've added below one in web.config

<staticContent>
   <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
</staticContent>

But I'm not seeing expires on response headers. Should I do any other changes?

enter image description here

like image 929
user3194721 Avatar asked Sep 11 '14 00:09

user3194721


1 Answers

I would try two things to debug. First I would change cacheControlCustom from private to public

<location path="Content">
  <system.webServer>
    <staticContent>
      <clientCache 
             cacheControlCustom="public" 
             cacheControlMode="UseMaxAge" 
             cacheControlMaxAge="10.00:00:00" />
    </staticContent>
  </system.webServer>
</location>

If that does not work check the location of your path covered for caching. Your example is not showing that part.

Lastly, try to unlock StaticContent section of machine config via:

appcmd unlock config /section:staticContent

Here is a link with some additional useful information Client Cache.

like image 81
CrnaStena Avatar answered Sep 22 '22 08:09

CrnaStena