Asp.net MVC browser image caching

In my asp.net/mvc (html 5) application, I have the Add / Edit Product user interface, which has 4 steps. In step 3, we have an image upload / display page.

As soon as the user uploads the images, I need to cache them in a browser. (So ​​that the user does not request the same image from the server before the cache expires)

What are the best approaches to achieve this kind of caching? (Can I use html 5 local storage? Or is using static caching of content using IIS (or webconfig) enough?)

+4
source share
1 answer

Add the following to the web.config file in the section:

<staticcontent>
  <clientcache cachecontrolmode="UseMaxAge" cachecontrolmaxage="60.00:00:00" />
</staticcontent>

This will set a 60-day caching limit for your static content. The user’s web browser will be asked to save the content for the period you set.

Edit: found a link that describes the use of the parameter: http://blogs.msdn.com/b/rickandy/archive/2011/05/21/using-cdns-to-improve-web-site-performance.aspx

+10
source

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


All Articles