开发者

How to cache result of Html.RenderPartialView

开发者 https://www.devze.com 2022-12-22 10:25 出处:网络
I\'m on project using asp.net mvc2. In master page I have some lines of code line this <% Html.RenderPartialView(\"Header\", Model.HeaderData) %>

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

精彩评论

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

关注公众号