liveBook · Manning

Route template

A route template is a URL path pattern, often containing parameters, that an application uses to match requests to handlers or operations.

How 2 Manning books explain it

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

What to know first

Related concepts

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.