liveBook · Manning

RouteAttribute

RouteAttribute is an ASP.NET Core attribute that associates a controller or action with a route template.

How 3 Manning books explain it

Pro ASP.NET Core 7, Tenth Edition

The Route attribute declares URL route information on an ASP.NET Core controller or action.

How it is used
Sets a web-service controller’s base URL for matching HTTP requests to actions.
How deep it goes
Explains controller-token substitution and composition with action routes, but does not detail routing internals.
Examples
Uses a ProductsController with GET routes for `/api/products` and `/api/products/{id}`.
What you can do after
Apply it via ASP.NET Core MVC to give a controller a base URL and distinguish GET endpoints.

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

ASP.NET Core in Action, 3e

RouteAttribute is an ASP.NET Core attribute that associates a controller action with a route template.

How it is used
Maps explicit URL templates to web API controller actions and controls the URLs exposed by an API.
How deep it goes
Explains literal segments, parameters, multiple templates, controller prefixes, absolute routes, and HTTP-verb constraints.
Examples
Uses HomeController, CarController, appointment endpoints, multiple URLs, route parameters, and shared api/car prefixes.
What you can do after
Apply it via ASP.NET Core attributes to build explicit API URLs and constrain actions to required HTTP verbs.

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

Building Web APIs with ASP.NET Core

A route attribute is an ASP.NET Core attribute that associates a controller or action with a route template.

How it is used
Configures controller and action URL patterns in an ASP.NET Core web API.
How deep it goes
Explains controller-level prefixes and route-template choices, while deferring broader API status-code conventions.
Examples
Uses SampleController routes for collection, identifier, and delete requests, plus SeedController’s [controller] route.
What you can do after
Configure controller URL patterns and combine them with HTTP verb attributes to expose API actions.

Read how Building Web APIs with ASP.NET Core explains RouteAttribute →

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.