Hi and thanks for looking!
Background
C#, .NET 4.0, MVC, currently running in debug mode on localhost.
Question
Is it possible to cache the result of the HandleUnknownAction() override?
I am attempting to do so, but it doesn’t seem to be caching anything.
Here is an example:
[OutputCache(Duration = 600, Location = OutputCacheLocation.Server, VaryByParam = "actionName")]
protected override void HandleUnknownAction(string actionName)
{
View("SomeView").ExecuteResult(ControllerContext);
}
I don’t think you can, and here’s why: If you reference the MSDN Documentation on the
OutputCacheAttributeClass (here), you can see the definition as it caches the output of the action method. In this case, theController.HandleUnknownAction()method returnsvoid, so there is no output to cache.So, unfortunately, I don’t think it works like that.