C# Asp.net核心cookie身份验证请求过多
下面我将为我的简单web应用程序添加身份验证 我在startup.cs Configure方法中添加了以下代码C# Asp.net核心cookie身份验证请求过多,c#,authentication,cookies,asp.net-core-mvc,asp.net-core-1.0,C#,Authentication,Cookies,Asp.net Core Mvc,Asp.net Core 1.0,下面我将为我的简单web应用程序添加身份验证 我在startup.cs Configure方法中添加了以下代码 app.UseCookieAuthentication(new CookieAuthenticationOptions() { AuthenticationScheme = "Cookies", LoginPath = new PathString("/Account/Login/"), AccessDeniedPath = new PathString("/A
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AuthenticationScheme = "Cookies",
LoginPath = new PathString("/Account/Login/"),
AccessDeniedPath = new PathString("/Account/Error/"),
AutomaticAuthenticate = true,
AutomaticChallenge = true
});
当我访问/Home时,它会重定向到/Account/Login,但页面并没有打开,错误消息如下所示
localhost页面不工作:localhost重定向您的次数太多
url多次附加相同的登录页面,看起来像
我做错了什么?请帮助我解决此问题。这是因为您的
/Account/Login
操作也需要登录,这会导致无限重定向循环。在此操作上添加AllowAnonymous属性。在我的情况下,/Account/Login
控制器已经具有AllowAnonymous属性,但我一直收到消息
localhost页面不起作用:localhost重定向您的次数太多
时代
问题出在IIS配置中。我必须更改“身份验证”选项卡中的一些选项。我必须禁用Windows身份验证选项并启用匿名身份验证选项