加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-core – 如何在使用asp.net 5时更改登录URL

发布时间:2020-12-16 04:04:02 所属栏目:asp.Net 来源:网络整理
导读:我使用asp.net 5和Identity 3来验证用户,但它总是重定向到默认的登录URL,即“帐户/登录”.我想改变它,但似乎没有任何地方可以设置这个选项.我在Configure()方法中使用AddIdentity().请帮忙. 谢谢 解决方法 app.UseCookieAuthentication(options ={ options.L
我使用asp.net 5和Identity 3来验证用户,但它总是重定向到默认的登录URL,即“帐户/登录”.我想改变它,但似乎没有任何地方可以设置这个选项.我在Configure()方法中使用AddIdentity().请帮忙.
谢谢

解决方法

app.UseCookieAuthentication(options =>
{
    options.LoginPath = new PathString("/Admin/Login");
    options.LogoutPath = new PathString("/Admin/LogOff");
},IdentityOptions.ApplicationCookieAuthenticationScheme
);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读