首页 新闻 赞助 找找看

outputCache 中 设置 location="Client" 无效?

0
悬赏园豆:20 [已关闭问题] 关闭于 2014-09-16 10:48

配置文件

<configuration>
  <system.web>
    <caching>
      <outputCacheSettings>
        <outputCacheProfiles>
          <add name="outputCache60" duration="60" enabled="true" location="Client" varyByParam="*" />
        </outputCacheProfiles>
      </outputCacheSettings>
    </caching>
    <compilation debug="true"/>
  </system.web>
</configuration>

页面文件

<%@ OutputCache CacheProfile="outputCache60"  %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <%=DateTime.Now %>
    </div>
    </form>
</body>
</html>


配置文件中设置  location="Client" 模式,缓存在客户端浏览器上,但是每次刷新客户端,状态码都是200 不是 304  ,各位大侠这是为啥?

释迦苦僧的主页 释迦苦僧 | 菜鸟二级 | 园豆:238
提问于:2014-09-15 18:11
< >
分享
所有回答(1)
1

指定OutputCache中的属性Location=”Client”表示客户端缓存,当用户在浏览器中点击“后退”按钮或在地址栏中重新输入URL,在这种情况下,浏览器将从缓存获取页面,如果用户点击“刷新”按钮,那么浏览器中缓存将失效,浏览器发送页面请求。至于状态码为200和304是在不同的浏览器表现是不一样的。

Eric.Hu | 园豆:140 (初学一级) | 2014-09-16 11:19

3q

支持(0) 反对(0) 释迦苦僧 | 园豆:238 (菜鸟二级) | 2014-09-16 11:21
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册