Force browser to clear cache

后端 未结 17 2406
夕颜
夕颜 2020-11-22 05:04

Is there a way I can put some code on my page so when someone visits a site, it clears the browser cache, so they can view the changes?

Languages used: ASP.NET, VB.N

17条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 06:01

    For static resources right caching would be to use query parameters with value of each deployment or file version. This will have effect of clearing cache after each deployment.

    /Content/css/Site.css?version={FileVersionNumber}
    

    Here is ASP.NET MVC example.

    
    

    Don't forget to update assembly version.

提交回复
热议问题