Exclude favicon from clientCache section
Currently I have clientCache Web.config cache wh开发者_开发技巧ich caches all statis content:
<staticContent>
<clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode ="UseExpires"/>
</staticContent>
But I want to exclude favicon.ico from caching (or make it expiration date less). Is there any way to implement it?
Try adding <location>
under <configuration>
tag, specifying that it should be applied to that file only -- something like this (just an example -- taken from real working configuration, where favicon.ico has different expire time compared to all other files):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
...
<!-- your site config here -->
...
</system.webServer>
<location path="favicon.ico">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="366.00:00:00" />
</staticContent>
</system.webServer>
</location>
</configuration>
精彩评论