Blazor University Learn the .NET SPA framework from Microsoft
Ctrl X

404 - Not found

When Blazor fails to match a URL to a component we might want to tell it what content to display.

The Router component has a RenderFragment parameter named NotFound which is a RenderFragment. Any Razor mark-up defined within this parameter of the Router component will be displayed when attempting to reach a URL the router cannot match to any component.

<Router AppAssembly="typeof(Program).Assembly">
	<Found Context="routeData">
		<RouteView RouteData="routeData" />
	</Found>
	<NotFound>
		<div class="content">
			<h1>PAGE NOT FOUND</h1>
			<p>
				The page you have requested could not be found. <a href="/">Return to the home page.</a>
			</p>
		</div>
	</NotFound>
</Router>