My website is https://medbase.co.zw.
If I navigate to a page within the app, it works. But if I copy and paste the url into another tab, it routes to not found.
https://medbase.co.zw/questions/13 Try clicking this
This started after I changed the app to .NET 8, removing the _Host.cshtml, renamimg App to Routes and App becoming what it is now. In addition, I have had to add the <HeadOutlet @rendermode="@RenderMode.InteractiveServer" /> and <Routes @rendermode="@RenderMode.InteractiveServer" /> so that the app works with MudBlazor. I find that if I remove the render mode tag, MudBlazor navigation panels do not work.
Relevant code pasted below
App.razor
<!DOCTYPE html><html lang="en" data-bs-theme="light"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><base href="/" /><link href="MedbaseBlazor.styles.css" rel="stylesheet" /><link href="_content/MedbaseComponents/wwwroot/css/mdstyles.css" rel="stylesheet" /><link rel="stylesheet" href="/css/bootstrap/bootstrap.min.css" /><link rel="stylesheet" href="_content/MedbaseComponents/wwwroot/css/common.css" /><HeadOutlet @rendermode="@RenderMode.InteractiveServer" /><link href="css/site.css" rel="stylesheet" /><!--WhatsApp Metas--><meta property="og:site_name" content="Medbase"><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link rel="apple-touch-icon" sizes="180x180" href="~/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="~/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="~/favicon-16x16.png"><link rel="manifest" href="~/site.webmanifest"><meta name="theme-color" content="#80b0fa"><!--Mudblazor References--><!-- Google Tag Manager --><!-- End Google Tag Manager --><!--Microsoft Clarity--><!--Google Ads Line--></head><body><Routes @rendermode="@RenderMode.InteractiveServer" /><div id="blazor-error-ui"> An unhandled error has occurred.<a href="" class="reload">Reload</a><a class="dismiss">🗙</a></div></body></html>Routes.razor
<CascadingAuthenticationState><Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="new[] { typeof(MedbaseComponents.Pages.Questions).Assembly, typeof(MedbaseComponents.Pages.Topics).Assembly, typeof(MedbaseComponents.Pages.Store.Store).Assembly, typeof(MedbaseComponents.Pages.Essays.Essays).Assembly, typeof(MedbaseComponents.Pages.Articles.Articles).Assembly, typeof(MedbaseComponents.Pages.Notes.Notes).Assembly, typeof(MedbaseComponents.Pages.Questions2.QuestionsPage2).Assembly, }"><Found Context="routeData"><AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(WebLayout)" /><FocusOnNavigate RouteData="@routeData" Selector="h1" /></Found></Router></CascadingAuthenticationState>Program.cs
using MedbaseLibrary.Services;using MudBlazor;using MudBlazor.Services;using MedbaseBlazor;using System.IdentityModel.Tokens.Jwt;using MedbaseBlazor.Pages;using MedbaseLibrary.Essays;using MedbaseLibrary.Notes;using Auth0.AspNetCore.Authentication;using Microsoft.AspNetCore.Authentication.Cookies;using Microsoft.AspNetCore.Authentication;using MedbaseLibrary.Store;using MedbaseLibrary.Questions;using MedbaseLibrary.CoursesAndTopics;var builder = WebApplication.CreateBuilder(args);builder.AddServiceDefaults();var environment = args.Contains("--local") ? Environments.Development : Environments.Production;//DependenciesJwtSecurityTokenHandler.DefaultMapInboundClaims = false;builder.Services.AddCascadingAuthenticationState();builder.Services.AddMudServices();builder.Services.AddMudMarkdownServices();builder.Services.AddRazorComponents().AddInteractiveServerComponents();var app = builder.Build();// Configure the HTTP request pipeline.if (!app.Environment.IsDevelopment()){ app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts();}app.UseHttpsRedirection();app.UseStaticFiles();app.UseAuthentication();app.UseAuthorization();app.UseRouting();app.UseAntiforgery();app.UseDeveloperExceptionPage();app.MapRazorComponents<App>().AddInteractiveServerRenderMode();app.UseStatusCodePagesWithRedirects("/StatusCode/{0}");app.Run();