asp.net core 2.2 Identity was added via
services.AddIdentity<ApplicationUser, ApplicationRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders()
.AddDefaultUI();
The login is set to "/Identity/Account/Login":
options.LoginPath = "/Identity/Account/Login";
Now how do I change the routes from the Identity area, which was added via the Startup.cs so that I can do for example:
https://www.example.com/admin instead of having https://www.example.com/identity/account/login
or
https://www.example.com/register so that it goes to HomeController->RegisterAction. This would allow me to catch and redirect the HomeController->RegisterAction it to HomeController->IndexAction in order to disable the registrations.
If anyone searches the answer for asp.net core mvc 2.2:
When you call DefaultUI you don't have any specific pages or controllers to modify.
You have to Scaffold the pages you want to modify.
Now you will see in /Areas/Identity/Pages/Account/Register.cshtml
Expand Register.cshtml and open the file Register.cshtml.cs. ('codebehind')
Now if you want to disable registrations, you can replace
public void OnGet(string returnUrl = null)
{
ReturnUrl = returnUrl;
}
with:
public IActionResult OnGet(string returnUrl = null) => RedirectToPage("/Account/Login"); // disable registrations
Additional info:
In case any [MSFT] is reading this: it would be great if you could disable registrations or change redirect routes via Startup.cs without having to scaffold (which would allow you to update packages without having the UI you once scaffolded at version x.