ASP.NET应用程序中的浏览器缓存 [英] Browser Caching in ASP.NET application

查看:381
本文介绍了ASP.NET应用程序中的浏览器缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关如何在asp.net应用程序中执行浏览器缓存的任何建议。我在网上找到了一些不同的方法,但不知道什么是最好的。具体来说,我想缓存我的CSS和JS文件。他们做改变,但是,通常每月一次。另一种技术是将静态图片,css和js存储在另一个服务器上(例如

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 would like to cache my CSS and JS files. They do change, however, it is usually once a month at the most.

推荐答案

://en.wikipedia.org/wiki/Content_Delivery_Networkrel =nofollow noreferrer> CDN ),它已正确设置Expires标头。其优点是双重的:

Another technique is to stores you static images, css and js on another server (such as a CDN) which has the Expires header set properly. The advantage of this is two-fold:


  1. expires标头将鼓励浏览器和代理缓存这些静态文件

  2. CDN将从提供静态文件的服务器卸载。

  3. 通过为静态内容使用其他域名,浏览器将下载速度更快。这是因为从四个或五个不同的主机名提供资源会增加下载的并行性

  4. 如果CDN配置正确,并使用 cookieless domain ,则您没有不必要的Cookie来回。

  1. The expires header will encourage browsers and proxies to cache these static files
  2. The CDN will offload from your server serving up static files.
  3. By using another domain name for your static content, browsers will download faster. This is because serving resources from four or five different hostnames increases parallelization of downloads.
  4. If the CDN is configured properly and uses cookieless domain then you don't have unnecessary cookies going back and forth.

这篇关于ASP.NET应用程序中的浏览器缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆