Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: OutputCache CacheProfile varyByParam does not work [425]

$
0
0
I've faced a problem when varyByParam set in web.config was not respected.

<add name="MyName" duration="5" varyByParam="none" />

//this works
[OutputCache(CacheProfile = "MyName", VaryByParam = "None")]

//this doesn't
[OutputCache(CacheProfile = "MyName")]

I've looked into source code, and I've found
private OutputCacheParameters _cacheSettings = new OutputCacheParameters { VaryByParam = "*" };
in OutputCacheAttribute. If I understand it right, it means that varyByParam from CacheProfile will be overridden with "*".
// Pick up the settings from the configuration settings profile first
...
// Start overriding options from the directive
if (cacheSettings.IsParameterSet(OutputCacheParameter.VaryByParam)) {
varyByParam = cacheSettings.VaryByParam;
}
Comments: I have similar question. Although we have the following logic In the source code (OutputCacheAttribute.cs): public string CacheProfile { get { return _cacheSettings.CacheProfile ?? String.Empty; } set { _cacheSettings.CacheProfile = value; } } while I track the code in the debug mode, it seems that assigning a profile name to "CacheProfile" property doesn't change "duration", "VaryByParam", etc. How does assigning value to "_cacheSettings.CacheProfile" suppose to read related data from web.config and assign them to other properties of _cacheSettings?

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>