Events
Mar 17, 11 PM - Mar 21, 11 PM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
A bug in the Blazor routing implementation affected how the precedence of routes was determined. This bug affects catch-all routes or routes with optional parameters within your Blazor app.
5.0.1
With the erroneous behavior, routes with lower precedence are considered and matched over routes with higher precedence. For example, the {*slug}
route is matched before /customer/{id}
.
The current behavior more closely matches the routing behavior defined in ASP.NET Core apps. The framework determines the route precedence for each segment first. The route's length is used only as a second criteria to break ties.
The original behavior is considered a bug in the implementation. As a goal, the routing system in Blazor apps should behave the same way as the routing system in the rest of ASP.NET Core.
If upgrading from previous versions of Blazor to 5.x, use the PreferExactMatches
attribute on the Router
component. This attribute can be used to opt in to the correct behavior. For example:
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="true">
When PreferExactMatches
is set to true
, route matching prefers exact matches over wildcards.
None
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
Mar 17, 11 PM - Mar 21, 11 PM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Use pages, routing, and layouts to improve Blazor navigation - Training
Learn how to optimize your app's navigation, use parameters from the URL, and create reusable layouts in a Blazor web app.
Documentation
ASP.NET Core Blazor routing and navigation
Learn how to manage Blazor app request routing and how to use the Navigation Manager and NavLink component for navigation.
ASP.NET Core Razor component lifecycle
Learn about the ASP.NET Core Razor component lifecycle and how to use lifecycle events.