asp.net core 3.1 cookie httpOnly 登录验证
region set-cookie to ie 1.startup.cs ConfigureServices 添加 //注册Cookie认证服务 services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, option => { option.AccessDeniedPath = "/Login"; //当用户尝试访问资源但没有通过任何授权策略时,这是请求会重定向的相对路径资源 option.LoginPath = "/Login/"; option.Cookie.Name = "token";//设置存储用户登录信息(用户Token信息)的Cookie名称 option.Cookie.HttpOnly = true;//设置存储用户登录信息(用户Token信息)的Cookie,无法通过客户端浏览器脚本(如JavaScript等)访问到 //option.Cookie.SecurePolicy = Microsoft.AspNetCore.Http.CookieSecurePolicy.Always;//设置存储用户登录信息(用户Token信息)的Cookie