0

I have a large menu with lots of pictures that appears on top of every page.

What I thought was to put my menu in a PartialView and store it in OutputCache. But then, all the menu content still have to make the trip from server to client on every new page load.

Would it be possible to set the OutputCacheLocation for a PartialView to Client?

I would be surprised if this was possible, but then what would happen if I do set the cache location of a PartialView to Client? Would it be ignored or cached on the sever?

1 Answers1

0

For caching on client side you can use the attribute

[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client)]

You can read more here - ASP.NET MVC - caching pages on client side

artista_14
  • 674
  • 8
  • 22
  • Thanks... yes I had read this article... My question is, is it actually possible to cache a partial view on client side. –  Feb 06 '18 at 09:10
  • If you are asking a boolean answer definitely answer is yes. – artista_14 Feb 06 '18 at 09:20
  • Thanks - do you know how all this is happening? My understanding is when a request is sent to the server, the server builds the HTML response and send it back to the client. How would the server know that part of this HTML Response (PartialView) already exists on the client, and it should leave that part empty? and what would happen if client suddenly clears the cache? I don't realize how this is actually possible. –  Feb 06 '18 at 10:30