views:

50

answers:

1

Hi all,

I'm on project using asp.net mvc2.

In master page I have some lines of code line this

<% Html.RenderPartialView("Header", Model.HeaderData) %>
...
<% Html.RenderPartialView("LeftMenu", Model.MenuData) %>
...
<% Html.RenderPartialView("Footer") %>

How could I apply caching to RenderPartialView

Thanks

A: 

You can not easily - the main problem is that at that at that point the caching thing is already done. it is executing the page construction.

Check http://www.klopfenstein.net/lorenz.aspx/output-donut-caching-attribute-asp-net-mvc-partial-requests for some stuff in this direction (including a nice discussion how caching workd under the hood).

TomTom