且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何指定HTTP过期标头? (ASP.NET MVC + IIS)

更新时间:2023-02-25 12:59:18

发现:

我需要指定静态内容(在web.config中)客户端缓存。

I need to specify client cache for static content (in web.config).

<configuration>
  <system.webServer>
    <staticContent>
      <clientCache cacheControlCustom="public" 
      cacheControlMaxAge="12:00:00" cacheControlMode="UseMaxAge" />
    </staticContent>
   </system.webServer>
</configuration>

从http://www.iis.net/ConfigReference/system.webServer/staticContent/clientCache