RouteAttribute
RouteAttribute is an ASP.NET Core attribute that associates a controller or action with a route template.
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
- controllerconfigures · A controller is a software component or architectural role that receives inputs or requests and coordinates their handling by other parts of an application.
- route templateconfigures · A route template is a URL or URI path pattern containing fixed segments and parameters that determines which requests an endpoint matches.
- explicit routingused by · Explicit routing is a routing approach in which each endpoint is assigned a specific URL pattern directly, often through route templates or attributes.
- routingused by · Routing is the selection of a path, destination, or processing component to direct an item, request, or flow toward an intended endpoint.
- web API action methodconfigures · A web API action method is a controller method associated with a matched HTTP request that processes it and produces a response.
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.


