I added the Identity Core to my Blazor Server app with the Identity scaffolding. When doing so, I had it write out a copy of Register.cshtml so I could edit it. That worked correctly.
I then created a Register.razor to replace the page with a Blazor page (so I can use the component library we use for all of our pages).
The Register.razor page works fine - if it has a unique url. But if I give it:
@page "/Identity/Account/Register"
then going to https://localhost:7229/identity/account/register brings up the original Register page in the Identity dll. How can I set it so my razor page is called instead of the MVC page in the Identity dll?
The basic problem is there are two pages with the same url and I need mine to be the one selected when that url is requested.
Note: Yes the "correct" solution is to remove the MVC register.cshtml. Unfortunately that is in the Identity dll and I need that dll.
I came up with a solution that works great.
Step 1 - write a distinct .razor page to handle registration. Nothing to do with the existing MVC register.cshtml page. Rather a clean new Blazor page.
In Register.cshtml.cs add the following:
public void OnGet()
{
// go to the Blazor register page
LocalRedirect("/Account/Register");
}
And done. So don't edit/revise the existing MVC page, create a new page at a new page location.