OutputCache stopping my username from displaying in header

我只是一个虾纸丫 提交于 2019-12-04 19:21:21

I have used the donut caching library (mentioned by spender in the comments above) to solve a very similar problem.

Once your project has a reference to the MvcDonutCaching library, you can call an extended Html.Action method to exclude it from the cache e.g.

// Action(this HtmlHelper htmlHelper, string actionName, string controllerName, bool excludeFromParentCache)
@Html.Action("LoginStatus", "Home", true) 

To do this, you obviously would need to isolate the part you don't want to cache to its own action and partial view.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!