0
var claims = new[]
{
new Claim("UserID", user.ID.ToString()),
new Claim(ClaimTypes.Role, "pioneer")
};
var principal = new ClaimsPrincipal(
new ClaimsIdentity(
claims, CookieAuthenticationDefaults.AuthenticationScheme));
await HttpContext.Authentication.SignInAsync("Cookies", principal);
这是我创建和使用从本教程登录按指令饼干:https://docs.microsoft.com/en-us/aspnet/core/security/authentication/cookie如何访问cookie的asp.net核心
正在创建的cookie,但我不” t知道如何访问cookie或其中的数据以获取user.ID值。