ASP认同MVC6 - 登录Path属性不工作 [英] ASP Identity in MVC6 - Login Path property not working

查看:149
本文介绍了ASP认同MVC6 - 登录Path属性不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Beta 5更新到公测8我不能设置cookie认证选项我的自定义登录路径后。

After updating from beta 5 to beta 8 I can't set my custom login path in cookie authentication options.

services.AddCookieAuthentication(config =>
{
    config.LoginPath = "/Auth/Login";
    //or
    //config.LoginPath = new Microsoft.AspNet.Http.PathString("Auth/Login");
});

这值完全忽略。还是被重定向到默认的 /帐号/登录的'。是否有任何其他选项来设置这个路径?

This value is completely ignored. Still gets redirected to the default '/Account/Login'. Is there any other options to set this path?

推荐答案

看来,现在你应该这样做有点不同(为我工作):

It seems that now you should do this a bit differently (worked for me):

services.Configure<IdentityOptions>(options=>
{
    options.Cookies.ApplicationCookie.LoginPath = new Microsoft.AspNet.Http.PathString("/Auth/Login");
});



从的这里

这篇关于ASP认同MVC6 - 登录Path属性不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆