Mar 29, 2012 at 4:07 PM

I have tried to get this working with an MVC4 site, but without success. Works fine with MVC3. Is this a known issue?


Mar 30, 2012 at 10:17 AM
Edited Mar 30, 2012 at 10:18 AM

It works fine with MVC4 for me. It does target the MVC3 binaries  (and will do until MVC4 is officially released) so you will need binding redirects in your web.config. These are normally automatically added but in case they are missing, you can add them back:

  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="" newVersion="" />
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="" newVersion="" />
      <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="" newVersion="" />

If it is another issue, let me know the exact problem you are having and i will take a look.

Mar 30, 2012 at 12:28 PM

Hi, thanks for the response. The caching works fine in a view in the root Views folder, but not in a view contained in an Area.

I've tried adding the runtime stuff to the Area web.config, but that makes no difference.

To reproduce:

Create an Area
Create a Controller, add the DonutOutputCache attribute to the ActionResult method
Create a secondary ActionResult in the controller with its own view containing something you don't want cached
Create a @Html.Action in the primary view targetting the secondary ActionResult  with the 'true' flag to prevent caching
... Caches anyway :(

If you do the above in a non-area view it works fine.