【问题标题】:ASP.NET MVC web.config : how to cache specific js and css fileASP.NET MVC web.config:如何缓存特定的 js 和 css 文件
【发布时间】:2022-01-02 02:09:10
【问题描述】:

我必须通过web.config 设置缓存特定的静态文件,例如(jQuery、jQuery UI、Bootstrap 和一些未更改的自定义 js 文件)。

我不想只使用扩展名来缓存所有 js 或 css 文件。到目前为止,我已经使用下面的代码来缓存静态内容。但它没有仅按名称缓存特定文件的功能。

<system.webServer>
      <staticContent>
        <clientCache cacheControlMode="UseMaxAge"cacheControlMaxAge="1.00:00:00" />
    </staticContent>
</system.webServer>

【问题讨论】:

    标签: jquery .net asp.net-mvc caching web-config


    【解决方案1】:

    实际上,浏览器会自动为您解决这个问题。您必须竭尽全力让它们不缓存 css 和 js 文件

    【讨论】:

      猜你喜欢
      • 2020-06-07
      • 2017-05-14
      • 2012-09-21
      • 2020-04-25
      • 1970-01-01
      • 2011-11-24
      • 2013-02-09
      • 2011-06-21
      • 1970-01-01
      相关资源
      最近更新 更多