开发者

How to cache result of Html.RenderPartialView

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) %>
...
&l开发者_运维技巧t;% Html.RenderPartialView("Footer") %>

How could I apply caching to RenderPartialView

Thanks


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜