I am beginner in MVC and I have a project to transform from MVC2 to the latest version of MVC. I read read some books on MVC 4, so I started to understand the main mechanisms.
However, when transforming my MVC 2 solution, I have a problem with an attribute: OutputCache
.
By eg. I have multiple Actions like this (the attributes may vary):
[OutputCache(CacheProfile = "ProductImage")]
public ActionResult GetImage(Guid elementId, int imgtype)
in the Web.Config i have in the "caching>outputCacheSettings>outputCacheProfiles>":
<add name="ProductImage" duration="5" varyByParam="elementId,imgtype" />
and obtaining the following exception in output:
OutputCacheAttribute for child actions only supports Duration, VaryByCustom, and VaryByParam values. Please do not set CacheProfile, Location, NoStore, SqlDependency, VaryByContentEncoding, or VaryByHeader values for child actions.
As I understood, the problem appears only with the child actions.
Resolved installing MvcDonutCaching nuget and replacing [OutputCache
with [DonutOutputCache
...
See more about.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With