I have been trying to add ContentOutputCache to a block controller so that the blocks can have caching enabled. I put the attribute above the action of Index to apply it to the action so that whenever the block is used it will cache the details inside. When running the site and going to the page, I get the following error:
I have tried to apply the output cache to the Alloy Demo and I also get the same error. Below is an example bit of code on what I am trying to do.
public class ContactBlockController : BlockController
public override ActionResult Index(ContactBlock currentBlock)
I have also added the settings into Web.Config to enable the caching as well.
After some more testing, I also tried it on the Page Controller. I made a property that renders the current DateTime to the view and disbled debug mode and ran the website in release mode. The caching still does not work on pages either.
Any help would be appreciated.
ContentOutputCache has several criteria:
You can configure httpCacheExpiration in web.config under configuration/episerver/applicationSettings. Alloy demo doesn't come with predefined httpCacheExpiration.
Thanks for the quick response. Completely overlooked the Logged In/ Logged Out scenerio. Have tried it and it works as expected now!
Thanks for for your help
@Dejan Caric Is there a way to disable this for so certain blocks are updated. Main example is we use a C# Twitter library and the block does not update when the Caching is on for the page it is contained in.
Thanks in advance