【问题标题】:Set-Cookie not working in chromeSet-Cookie 在 chrome 中不起作用
【发布时间】:2018-11-03 18:49:57
【问题描述】:

我有一个奇怪的问题,我开发的网站之一在请求登录页面时返回了 Anti-Forgery cookie。当我在 chrome 网络选项卡中检查响应时,它包含标题

Set-Cookie: .AspNetCore.Antiforgery.w5W7x28NAIs=xxx; path=/; samesite=strict; httponly

但是当我在“应用程序”选项卡(在 cookie 部分下)检查 cookie 值时,我找不到在浏览器中设置的任何 cookie。我还检查了带有 chrome 扩展名的 cookie,例如 EditThisCookie,但它也没有显示在那里。

网络标签:

应用程序选项卡:

我是否遗漏了一些简单的东西,或者这是某种 chrome (Version 66.0.3359.181 (Official Build) (64-bit)) 错误?

【问题讨论】:

标签: google-chrome cookies asp.net-core setcookie antiforgerytoken


【解决方案1】:

我有类似的问题,通过为每个请求设置withCredentials = true 来解决它。

对于角度来说,这基本上意味着:

this.http.get(url, {  withCredentials: true  });

【讨论】:

    猜你喜欢
    • 2017-07-19
    • 2020-04-05
    • 2012-11-09
    • 2020-12-11
    • 2013-08-08
    • 1970-01-01
    • 2011-12-17
    • 2019-09-06
    • 1970-01-01
    相关资源
    最近更新 更多