【问题标题】:Outputcache conflit with cookie输出缓存与 cookie 冲突
【发布时间】:2014-10-07 12:29:20
【问题描述】:

我在页面中实现了输出缓存,但它与基本页面冲突。 在基本页面中,我在 preint 事件中添加 cookie

                  HttpCookie currCookie = new HttpCookie("CurrencyId", "3");
                 currCookie.Expires = DateTime.Now.AddDays(1);
                Response.Cookies.Add(currCookie);
                 Request.Cookies.Set(currCookie);

如果我评论 Response.Cookies.Add(currCookie) 行输出缓存有效,但如果不是输出缓存无效

【问题讨论】:

    标签: c# asp.net cookies outputcache


    【解决方案1】:

    你不能两者都做。如果页面正在使用输出缓存,那么您将无法执行用户特定的任何操作。这违背了目的。它可以为所有用户缓存,也可以不缓存。它可以根据各种条件进行缓存,例如Param、Control或Header或自定义函数。

    【讨论】:

    • 我在全局配置中使用全局事件 updatecacherequest..它的工作
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-12
    • 1970-01-01
    • 2014-05-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-01
    • 2013-03-17
    相关资源
    最近更新 更多