Only MasterPage cache in ASP.NET MVC

I have a MasterPage that passed ViewData. I would really like to cache only MasterPage for performance reasons. But I do not want to cache the actual page loaded using MasterPage.

I believe this can be done in web forms by adding code to the Page_Load event. Does anyone know of a similar technique using ASP.NET MVC to achieve the same goal?

Thanks in advance.

+3
source share
1 answer

When you mean only caching of the main page only, do you mean the caching output or caching only ViewData related to the main page? You can use session or cache mechanisms to cache the data of the main page, but you will have to program the choice of what belongs to the wizard and what is for presentation.

If you are talking about output caching, I do not believe that output caching is available for master pages. For partial caching of output in ASP.NET MVC, Steve Sanderson has some great points: http://blog.codeville.net/2008/10/15/partial-output-caching-in-aspnet-mvc/

What type of caching are we talking about?

+1
source

Source: https://habr.com/ru/post/1730007/


All Articles