Invalidate client side caching

1k Views Asked by At

I have added caching for static content in my asp.net application

<staticContent> 
  <clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" /> 
<staticContent>

While pushing new changes to production,The javascript1.js its not updating in client's machine. Hence New changes in the JS is not updating

How can i invalidate caching in all my clients browsers ?

1

There are 1 best solutions below

6
On
  1. You probably just want to disable caching for your pages only and not all items (you prob want to exclude library files like jquery). In that case, you could use the following header

    [System.Web.Mvc.OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]

you could add the above header individually or a better way would be to add the class to a controller and make it the base for all your controllers.

  1. If you want to do it for the entire application, you could just add the following in your web config file

    ' '