【发布时间】:2019-06-09 05:35:51
【问题描述】:
asp.net core 2.2 Identity 是通过
添加的services.AddIdentity<ApplicationUser, ApplicationRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders()
.AddDefaultUI();
登录设置为“/Identity/Account/Login”:
options.LoginPath = "/Identity/Account/Login";
现在如何更改通过 Startup.cs 添加的 Identity 区域中的路由,以便我可以执行以下操作:
https://www.example.com/admin 而不是https://www.example.com/identity/account/login
或
https://www.example.com/register 以便它转到 HomeController->RegisterAction。这将允许我捕获 HomeController->RegisterAction 并将其重定向到 HomeController->IndexAction 以便禁用注册。
【问题讨论】:
-
这里已经回答了stackoverflow.com/questions/50682108/… ..虽然它已确认适用于 .NET Core 2.1 ,但也应该适用于 2.2 ..
标签: c# asp.net-core-mvc asp.net-identity asp.net-core-2.2