aspnetcore 操作Cookie

可以使用 ChunkingCookieManager

详见:

https://docs.microsoft.com/zh-cn/dotnet/api/microsoft.aspnetcore.authentication.cookies.chunkingcookiemanager?view=aspnetcore-5.0

var cm = new ChunkingCookieManager();
cm.AppendResponseCookie(Context, "name", "scott", new Microsoft.AspNetCore.Http.CookieOptions
{
    Expires = DateTimeOffset.Now.AddDays(1)
});

  

无需额外配置,网上其他的都是什么Cookie代理神马玩意的。。。

posted @ 2020-11-15 00:07  我的用户名  阅读(336)  评论(0编辑  收藏  举报