2016-12-11 40 views
0

我有以下的在我的启动类的dotnetcore web应用程序:UseCookieAuthentication犯规重定向到登录页面asp.net核心

app.UseCookieAuthentication(new CookieAuthenticationOptions 
      { 
       AuthenticationScheme = "Cookies", 
       AutomaticAuthenticate = true, 
       AutomaticChallenge = true, 
       LoginPath = "/account/login" 
      }) 

我得到一个401未经授权但不重定向到我/帐号/登录页面 - 任何想法?

+0

是否已确认'ConfigureAuth()'是不断叫什么名字? –

+0

在Configure方法中添加app.UseMvc(routes => { routes.MapRoute( name:“default”, template:“{controller = account}/{action = login}/{id?}”); }); –

回答

0

如果您的Cookie中间件的版本是1.0.0以上,请this