我真的希望有人有一些想法。我已经将我的web配置设置为缓存图像30天。
web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
</system.webServer>
</configuration>然而,当我使用IE请求页面并检查网络流量时,我看到的是:
Request Header:
Key Value
Request GET http://www.xx.com/Content/Icons/login.png HTTP/1.1
Accept image/png, image/svg+xml, image/*;q=0.8, */*;q=0.5
Referer http://www.selftestware.com/
Accept-Language en-US
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Accept-Encoding gzip, deflate
Host www.xx.com
If-Modified-Since Wed, 24 Aug 2011 15:48:10 GMT
If-None-Match W/"0195d397562cc1:0"
Proxy-Connection Keep-Alive
Pragma no-cache
Cookie __utma=xx
Response:
Key Value
Response HTTP/1.1 200 OK
Cache-Control public,max-age=2592000
Content-Type image/png
Last-Modified Wed, 24 Aug 2011 15:48:10 GMT
Accept-Ranges bytes
ETag W/"0195d397562cc1:0"
Server Microsoft-IIS/7.5
X-Powered-By ASP.NET
Date Wed, 24 Aug 2011 10:39:14 GMT
Content-Length 727如果它不发送304 (未修改)。我就是不明白这是怎么回事。
发布于 2011-08-28 23:34:14
您的请求头被发送了一个“cache Pragma: no-cache”,这意味着告诉服务器不要缓存这个请求。这就是您的服务器响应HTTP 200而不是HTTP 304的原因。
这是由浏览器发送的“高速缓存Pragma:no-”。如果您按下Ctrl+F5热键或将您的浏览器配置为不缓存任何内容,则会导致此结果。您可以尝试创建一个包含指向此缓存页的链接的空白页,然后单击该页上的链接。您将看到此页面已被缓存。
https://stackoverflow.com/questions/7174638
复制相似问题