I'm developing a website with MVC 5.2.3, it has a top menu bar in _Layout.cshtml
that contains logged in user information. Like user's FullName, so it shouldn't be cache.
For exclude this menu from OutPutCache, I created a child action for it.
[ChildActionOnly]
public PartialViewResult TopMenu()
{
return PartialView("~/Views/Partials/TopMenuPartial.cshtml");
}
After that, I installed MvcDonutCaching
nuget package and use it in _Layout.cshtml
as the following:
@Html.Action("TopMenu", "Home", true)
But, it doesn't work, and if someone login, it's FullName came in top menu bar for all clients.
How should I remove this child action from MVC OutPutCache