[Mono-aspnet-list] ASP.NET MVC OutputCache

Luckyrat chris.tomlinson at wildscreen.org.uk
Tue Oct 27 08:01:35 EDT 2009

Has anyone got the ASP.NET OutputCache to work on an MVC site on Mono I haven't found any working examples specific to Mono and
everything I try fails on Mono (but works on the ASP.NET development

I have tried putting declarations like this at the top of the Views:
<%@ OutputCache Duration="10" VaryByParam="None" Location="ServerAndClient"

The above works on standard ASP.NET pages but not when applied to MVC pages.
I've been testing on the sample MVC site you get when creating a new MVC
project in Visual Studio.

As I understand it, the usual way to enable caching in MVC websites is to
attach an attribute to an action or controller. E.g.:

[OutputCache(VaryByParam = "None", Duration = 15, Location =
public ActionResult Index()
    ViewData["Message"] = "Welcome to ASP.NET MVC!";
    return View();
Steve Sanderson has blogged about an alternative way to cache output from
MVC (to work around other limitations which we're not interested in at the

Using the alternative (non-reflective) version of his code I have managed to
get a working caching system in place but it would be nice to be able to use
the standard ASP.NET version since we're really not trying to do anything
clever, just cache the output of generally static pages to improve

Am I just missing something obvious? Do I need to "switch on" caching in MVC

Any tips or pointers to documentation or examples on this topic would be


View this message in context: http://www.nabble.com/ASP.NET-MVC-OutputCache-tp26076455p26076455.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.

More information about the Mono-aspnet-list mailing list