Skip to content

Commit a3de343

Browse files
committed
Updates
1 parent 380ed10 commit a3de343

File tree

1 file changed

+4
-4
lines changed
  • aspnetcore/release-notes/aspnetcore-10/includes

1 file changed

+4
-4
lines changed

aspnetcore/release-notes/aspnetcore-10/includes/blazor.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,18 +401,18 @@ For more information and examples, see <xref:blazor/fundamentals/routing?view=as
401401

402402
### Blazor router has a `NotFoundPage` parameter
403403

404-
Rendering content after triggering the `NavigationManager.NotFound` method can be now handled by passing a parameter with a component type to the router. This is now recommended over using the `NotFound` render fragment because `NotFoundPage` supports routing that can be used across re-execution middleware, including non-Blazor middleware. If the `NotFound` render fragment is defined together with `NotFoundPage`, the page has higher priority.
405-
406-
In the following example, a `NotFound` component is present in the app's `Pages` folder and passed to the `NotFoundPage` parameter. The `NotFound` page takes priority over the content in the `NotFound` fragment.
404+
Blazor now provides an improved way to display a "Not Found" page when navigating to a non-existent page. You can specify a page to render when `NavigationManager.NotFound` by passing a page type to the `Router` component using the `NotFoundPage` parameter. This approach is recommended over the previous `NotFound` fragment, as it supports routing, works across code re-execution middleware, and is compatible even with non-Blazor scenarios. If both a `NotFound` fragment and `NotFoundPage` are defined, the page specified by `NotFoundPage` takes priority.
407405

408406
```razor
409407
<Router AppAssembly="@typeof(Program).Assembly" NotFoundPage="typeof(Pages.NotFound)">
410408
<Found Context="routeData">
411409
<RouteView RouteData="@routeData" />
412410
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
413411
</Found>
414-
<NotFound>This content is ignored because 'NotFoundPage' is defined.</NotFound>
412+
<NotFound>This content is ignored because NotFoundPage is defined.</NotFound>
415413
</Router>
416414
```
417415

416+
The Blazor project template now includes a `NotFound.razor` page by default. This page automatically renders whenever `NavigationManager.NotFound` is called in your app, making it easier to handle missing routes with a consistent user experience.
417+
418418
For more information, see <xref:blazor/fundamentals/routing#not-found-responses>.

0 commit comments

Comments
 (0)