liveBook · Manning

Route data

Route data is a collection of named information associated with a route and made available for request handling, navigation, rendering, or URL generation.

How 2 Manning books explain it

ASP.NET Core in Action, 3e

Route data is a collection of named values supplied to an endpoint route during URL generation.

How it is used
Supplies named values to URL generation so links can follow an endpoint’s route template instead of hardcoding its path.
How deep it goes
Works through anonymous-object route data and named-endpoint path generation; defers Razor Pages and MVC URL-generation methods.
Examples
Demonstrates a named product endpoint generating /product/big-widget and a default parameter giving /product/shoes the value name=all.
What you can do after
Apply it via LinkGenerator.GetPathByName to generate a path for a named minimal API endpoint without hardcoding the link.

Read how ASP.NET Core in Action, 3e explains route data →

Pro ASP.NET Core 7, Tenth Edition

RouteData is the ASP.NET Core request-context data containing values produced by routing for the matched URL, including values captured from URL segments.

How it is used
Uses route values to adapt view-component output and supply action arguments through model binding.
How deep it goes
Demonstrates named-value access, a component unit test, and binding precedence without detailing routing internals.
Examples
Shows category-link highlighting, a route-data unit test, conditional controller-request output, and competing URL id values.
What you can do after
Apply it via ASP.NET Core RouteData.Values to tailor a view component or predict which id value an action receives.

Read how Pro ASP.NET Core 7, Tenth Edition explains route data →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.