【问题标题】:OutputCache Location = OutputCacheLocation.Client doesnt workOutputCache Location = OutputCacheLocation.Client 不起作用
【发布时间】:2014-03-10 16:46:03
【问题描述】:

我正在尝试使用OutputCache 缓存图像(从数据库返回)。不幸的是,这似乎不起作用。如果我设置Location = OutputCacheLocation.ServerAndClient,它会正确地将其缓存在服务器上,但不会缓存在浏览器上?有什么建议吗?

[OutputCache(Duration = 3600, 
            VaryByParam = "serialNumber;activityId", 
            Location = OutputCacheLocation.Client, 
            NoStore = true)]
public ActionResult GetImage(string serialNumber, int activityId)
{
    var byteArray = this.service.GetImage(serialNumber, activityId);
    return File(byteArray, "image/jpeg"); // adjust content type appropriately
}

【问题讨论】:

  • 你找到原因了吗?我也有同样的问题。

标签: asp.net-mvc outputcache


【解决方案1】:

为什么将 NoStore 设置为 true?我认为如果你删除它应该可以工作:

NoStore = true

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-18
    相关资源
    最近更新 更多