-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I have a Blazor InteractiveServer .NET 10 project, and I added NotFoundPage="typeof(Pages.NotFound)" to the Routes.razor page.
I also have a NotFound.razor page.
@page "/not-found"
@layout MainLayout
<h3>Not Found</h3>
<p>Sorry, the content you are looking for does not exist.</p>
When I navigate to an unkown URL, I just get the default not found page.
Expected Behavior
I expect the NotFound page to be rendered when I navigate to an unkown page.
Steps To Reproduce
- Add
NotFoundPage="typeof(Pages.NotFound)"to the Routes.razor page.
<Router AppAssembly="typeof(Program).Assembly" NotFoundPage="typeof(Pages.NotFound)">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
<FocusOnNavigate RouteData="routeData" Selector="h1" />
</Found>
</Router>
- Create a NotFound.Razor page
@page "/not-found"
@layout MainLayout
<h3>Not Found</h3>
<p>Sorry, the content you are looking for does not exist.</p>
Exceptions (if any)
No response
.NET Version
10
Anything else?
Blazor InteractiveServer
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components