您可以使用以下代码片段来确保应用程序正确读取cookie:
在 ConfigureAuth 函数中:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity
这里,您可以指定 cookie 的名称、详细信息和过期时间。希望这可以解决您的问题!