【发布时间】:2019-10-31 06:02:56
【问题描述】:
我在一个 cshtml 页面上有一个防伪造令牌 (@Html.AntiForgeryToken()),它会生成一个 cookie RequestVerificationToken_Lw。此 cookie 的属性值为 HTTP 和 Secure。但我也需要设置 SameSite。我如何做到这一点?
@Html.AntiForgeryToken()
__RequestVerificationToken_Lw__
【问题讨论】:
-
疯狂猜测.. 在您的启动课程中设置它? services.AddAntiforgery(options => { options.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Strict ; });
标签: html token antiforgerytoken samesite