Route template
A route template is a URL or URI path pattern containing fixed segments and parameters that determines which requests an endpoint matches.
ASP.NET Core in Action, 3e
A route template is a URL pattern containing fixed values and optional placeholders that determines which request URLs an endpoint matches.
- How it is used
- Maps request URLs to endpoints while extracting variable URL values for handlers.
- How deep it goes
- Works through literal, required, default, and optional segments, then identifies constraints and catch-all parameters without detailing their syntax here.
- Examples
- Uses a name-filtering minimal API, product URLs with defaults, file-based Razor Page routes, and combined controller attributes.
- What you can do after
- Build it from scratch with MapGet or customize it using Razor Page directives and controller route attributes.
Read how ASP.NET Core in Action, 3e explains route template →
.NET in Action, Second Edition
A route template is a URL pattern containing segments and parameters that ASP.NET Core uses to match requests to endpoint actions.
- How it is used
- Routes HTTP GET requests to the appropriate controller action using URL segments and the request verb.
- How deep it goes
- Explains controller and segment matching with a single parameter, but defers detailed route-template rules to documentation.
- Examples
- Uses CatalogController, [HttpGet("{id}")], GetBook(int id), and the /catalog/1 request.
- What you can do after
- Apply it via ASP.NET Core attributes to distinguish collection and single-resource GET endpoints.
Read how .NET in Action, Second Edition explains route template →
Related concepts
- IPageRouteModelConventionused by · IPageRouteModelConvention is an ASP.NET Core interface for modifying route templates and route metadata while Razor Page models are being constructed.
- page directiveconfigured by · The @page directive is a Razor directive that identifies a file as a routable Razor Page.
- RouteAttributeconfigured by · RouteAttribute is an ASP.NET Core attribute that associates a controller or action with a route template.
- static path segmenthas part · A static path segment is a fixed, non-parameter component of a URI path that must match its corresponding route segment.
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.

