【问题标题】:How to cache a page on IIS and client?如何在 IIS 和客户端上缓存页面?
【发布时间】:2014-12-14 17:05:43
【问题描述】:

我想缓存我的页面并使用这种类型的缓存

    [OutputCache(Duration = 21600, VaryByParam = "none")]
    public ActionResult Index()
    {
          //some codes
        return View();
    }

但我很困惑这种类型的缓存将存储在 IIS 或客户端浏览器上?

如何将我的页面缓存在用户浏览器而不是服务器上?

【问题讨论】:

    标签: asp.net-mvc caching browser-cache


    【解决方案1】:

    默认的 asp.net 缓存页面无处不在(服务器、代理、客户端)。你可以通过属性来改变它

    [Output(Location=OutputCacheLocation.Any)]
    

    您可以将 Location 属性设置为以下任一值:

    • OutputCacheLocation·任意
    • OutputCacheLocation·客户端
    • OutputCacheLocation.Downstream
    • OutputCacheLocation.Server
    • OutputCacheLocation.None
    • OutputCacheLocation.ServerAndClient

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-02
      • 2014-03-07
      • 2013-01-09
      • 2011-03-01
      • 2015-04-02
      相关资源
      最近更新 更多