MVC cache client for static content not working

I added below one in web.config

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

But I don't see what expires in the response headers. Should I make any other changes?

enter image description here

+6
source share
1 answer

I would try two things for debugging. 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 this does not work, check the location of your cache path. Your example does not show this part.

Finally, try unlocking the StaticContent section of the machine configuration with:

 appcmd unlock config /section:staticContent 

Here is a link to additional helpful client cache information .

+1
source

Source: https://habr.com/ru/post/975098/


All Articles