Browser Caching in ASP.NET application

后端 未结 6 2030
暖寄归人
暖寄归人 2020-12-14 21:43

Any suggestions on how to do browser caching within a asp.net application. I\'ve found some different methods online but wasn\'t sure what would be the best. Specifically, I

6条回答
  •  悲&欢浪女
    2020-12-14 22:17

    In .net you can set up your JavaScript, CSS and Images as embedded resources. .Net will then handle the file expiration for you. The downside to this approach is that you have to do a new build for each set of changes (this might be an upside, depending on your deployment and workflow).

    You could also use ETags, but from what I understand in some cases it doesn’t work well if you have mix of IIS and apache Webservers hosting your images, (or if you plan to switch in the future).

    You can just make sure the file date is newer, and let the server handle it for you, but you’ve got to make sure the server is configured correctly.

提交回复
热议问题