Route template
A route template is a URL path pattern, often containing parameters, that an application uses to match requests to handlers or operations.
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 and extracts variable path values for handlers.
- How deep it goes
- Explains matching, optional and default values, constraints, middleware selection, and template customization for Razor Pages and controllers.
- Examples
- Uses a person-name minimal API, product URLs with default and optional values, and file-based Razor Page routes.
- What you can do after
- Apply it in ASP.NET Core to map URLs, capture route values, and customize Razor Page templates.
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 →
Also covered in
- Go in Action, Second Edition
- Vanilla WebIn early access (MEAP)
- Pro Angular 16
What to know first
- regular expressionA regular expression is a formal pattern notation that describes sets of strings and specifies how text can be matched, searched, or transformed.
Related concepts
- endpointused by · An endpoint is an addressable interface of a service through which clients access a resource or invoke an operation, typically via a network request.
- IPageRouteModelConventionused by · IPageRouteModelConvention is an ASP.NET Core interface for modifying route templates and route metadata while Razor Page models are being constructed.
- 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.
- page directiveconfigured by · The @page directive is a Razor directive that identifies a file as a routable Razor Page.
Questions about route template
What is route template?
A route template is a URL path pattern, often containing parameters, that an application uses to match requests to handlers or operations.
Which Manning books explain route template?
ASP.NET Core in Action, 3e and .NET in Action, Second Edition.
What should I know before learning route template?
Manning books that teach route template usually introduce regular expression first.
What are the parts of route template?
Route template includes static path 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.

