I have a .NET8 Blazor web app, which I created without including Identity (long story why, not relevant now). I spent many hours getting the design right, and then realised that I needed Identify after all.
I created a new web app, including Identity, and copied the relevant files over to my existing project (adjusting namespaces to suit). I then added a migration, and updated the database.
The non-Identity parts of the app work fine, as they did before, but if I navigate to any of the Identity pages, such as /Account/Register, then I see the correct content for a few seconds, and then I get a plain white page with the words "Not found" at the top left.
As far as I can see, this is the default 404 behaviour. I added a Blazor component named OopsWrongUrl.razor (heck, I was over-tired and frustrated by the time I named it!) and updated Routes.razor to look like this...
<Router AppAssembly="typeof(Program).Assembly"><Found Context="routeData"><AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(MainLayout)"><NotAuthorized><RedirectToLogin /></NotAuthorized></AuthorizeRouteView></Found><NotFound><LayoutView Layout="@typeof(MainLayout)"><OopsWrongUrl /></LayoutView></NotFound></Router>Now when I navigate to an Identity page, I see my hand-crafted 404 page, so it does look like it's redirecting. However, I can't work out why it's doing this, nor where the redirection is happening. The only place in all the Identity stuff where I can see any navigating happening is in IdentityRedirectManager. However, I added breakpoints inside every method in there, and none of them were hit, so I don't think it's that.
This issue happens on every single Identity page, so it's not specific to any of the individual pages. It doesn't happen on any non-Identity pages.
I injected a NavigationManager into my 404 page, and used it to show the URL. This came up as http://localhost:5276/Account/Login. Not sure if this helps, as that's what the browser's address bar shows, ad matches the first line of Login.razor (which is the page I'm trying right now)...
@page "/Account/Login"Not sure if this helps.
I realise I haven't shown much code, but the bit I showed above is basically the only code I've changed from what the template supplied.
Anyone able to help? I just don't know where to look.