Reputation: 12996
I want to enable IIS output caching for ~/sitemap on our website. However when I look in the IIS Output Cache settings, it asks for the extension, an no where to include the path.
<caching>
<profiles>
<add extension=".aspx" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
</profiles>
</caching>
The path is www.site.com/sitemap - no extension.
How can I enable this?
Upvotes: 1
Views: 2279
Reputation: 12142
You can set the location property of the cache configuration block to refer to a file path and then set the extension within that to be a wild card.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="~/sitemap">
<system.webServer>
<caching enabled="true" enableKernelCache="true">
<profiles>
<add extension="*" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" />
</profiles>
</caching>
</system.webServer>
</location>
</configuration>
The combination of the two should seek to constrain the policy to the outer path ~/sitemap
while overcoming the required extension problem within the add
rule with the wildcard *
.
Note: there is also a location attribute within the add
rule.
This is a different location
property to what I'm referring to here as it concerns where to cache the content (client, server, etc) whereas the recommended outer location
scopes what gets cached.
Upvotes: 2