Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OutputCache and RenderAction cache whole page

I have a ViewPage that contains <% Html.RenderAction<MyController>(c => c.SidebarStats()); %>. On the controller action for the action SidebarStats I have an OutputCache action filter to cache only that part of the page. However, the whole page is getting cached and not just that action.

I remember seeing somewhere that this might be a bug with ASP.NET MVC though I'm not sure. I'm currently using ASP.NET MVC RC1, IIS7, Windows Server 2008 and .NET 3.5 SP1.

like image 677
Chad Moran Avatar asked Mar 03 '09 15:03

Chad Moran


2 Answers

I blogged a solution to this problem here. It's simple, but it only works if you're using the WebFormViewEngine. We will look hard into figuring out what it will take to make this work for all view engines.

like image 122
Haacked Avatar answered Sep 24 '22 22:09

Haacked


According to Microsoft this is a known bug with no known fix. Only workarounds suggested are to create your own OutputCache action filter.

like image 45
Chad Moran Avatar answered Sep 24 '22 22:09

Chad Moran