Outputcache attribute on clientside with partial pages'

老子叫甜甜 提交于 2019-12-01 18:24:19

Client side caching is not possible for partials in MVC 3. The client browser just receives HTML, 'partials' only exist on the server side.

Why don't you use server side caching?

When the content of your menu is dependent on the user, you could add the relevant user information to the parameters of your child action. For example:

[OutputCache(Duration=7200, VaryByParam="*")]  
public PartialViewResult Menu(int userId)
{
   ...
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!