Web.config - 缓存JS和CSS但不缓存HTML页面

时间:2015-06-19 12:56:46

标签: asp.net caching

我想在Azure网站上托管的静态网站上配置缓存。我的目标是缓存所有静态网站资源:JS,CSS和JPG文件,但不缓存HTML页面。我考虑将所有可缓存内容放入资源文件夹并仅缓存其内容,但是有更好的方法吗?我可以在web.config文件中以某种方式使用每个扩展规则吗?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <location path="~/assets">
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
    </staticContent>
  </system.webServer>
  </location>
</configuration>

0 个答案:

没有答案
相关问题