【问题标题】:Response.CacheControl not working in firefox or chromeResponse.CacheControl 在 Firefox 或 chrome 中不起作用
【发布时间】:2010-01-15 22:05:20
【问题描述】:

我在 global.asax.vb 中有这段代码,用于禁用后退按钮。

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
    Response.Buffer = True
    Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
    Response.Expires = -1
    Response.CacheControl = "no-cache"
End Sub

此代码在 IE 中完美运行,但拒绝在任何其他浏览器(如 firefox 或 chrome)中运行。我该怎么做才能使它成为多浏览器?

【问题讨论】:

    标签: asp.net caching response


    【解决方案1】:

    您可能想参考this article。它给出的答案是同时使用“no-cache”(对于 IE)和“no-store”(对于 Firefox)。使用“no-store”的原因是:“缺乏 no-cache 支持仅限于 Firefox 3.0 的早期版本,并且是由 bug 引起的。虽然,no-cache 现在应该单独工作,但访问者可能您的网站将运行受影响的 Firefox 版本。”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-08
      • 2017-11-08
      • 1970-01-01
      • 2014-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多