iis - How to configure static content cache per folder and extension in IIS7? -
i set rules in iis7 static content caching in asp.net website.
i have seen these articles, details how using <clientcache /> element in web.config:
client cache
<clientcache>(iis.net)
add expires or cache control header static content in iis (stack overflow)
however, setting appears apply globally static content. there way directories or extensions?
for example, may have 2 directories need separate cache settings:
/static/images
/content/pdfs
is possible set rules sending cache headers (max-age, expires, etc) based on extensions , folder paths?
please note, must able via web.config because don't have access iis console.
you can set specific cache-headers whole folder in either root web.config:
<?xml version="1.0" encoding="utf-8"?> <configuration> <!-- note use of 'location' tag specify folder applies to--> <location path="images"> <system.webserver> <staticcontent> <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="00:00:15" /> </staticcontent> </system.webserver> </location> </configuration> or can specify these in web.config file in content folder:
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <staticcontent> <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="00:00:15" /> </staticcontent> </system.webserver> </configuration> i'm not aware of built in mechanism target specific file types.
Comments
Post a Comment