Response.Cookies.Append("username", username, new CookieOptions { Expires = DateTime.Now.AddDays(1) });
.net core 2 为什么这样写不进去cookie?
要做什么操作吗?
services.Configure<CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies // is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; });
Core2.1开始ASP.NET支持GDPR规范,就是TM被禁了,是否是这原因?
这段代码什么意思啊?
@Eysa: 允许用COOKIE啊,2.1版是支持GDPR规范,给你的链接,或者自己百度
设置 CookieOptions.Domain 试试
Response.Cookies.Append("username", username, new CookieOptions
{
Expires = DateTime.Now.AddDays(1),
Domain = "localhost"
});
不行啊
@Eysa: 浏览器中看响应头
@dudu: 看啥呢?
@Eysa: 看 Cookie
@dudu:
不是我的cookie
@dudu: 能帮忙写下demo,把结果告诉我吗?