The route prefix is โโassociated with design routes in attribute routing.
Used to set a common prefix for the entire controller.
If you read the release notes that introduced this feature, you can get a better idea of โโthe subject.
ASP.NET Web API 2
Attribute Routing
ASP.NET Web API now supports attribute routing, thanks to Tim McCall's input. When routing attributes, you can specify web API routes to annotate your actions and controllers as follows:
[RoutePrefix("orders")] public class OrdersController : ApiController { [Route("{id}")] public Order Get(int id) { } [Route("{id}/approve")] public Order Approve(int id) { } }
Attribute routing gives you more control over the URIs in your API network. For example, you can easily define a hierarchy of resources using a single API controller:
public class MoviesController : ApiController { [Route("movies")] public IEnumerable<Movie> Get() { } [Route("actors/{actorId}/movies")] public IEnumerable<Movie> GetByActor(int actorId) { } [Route("directors/{directorId}/movies")] public IEnumerable<Movie> GetByDirector(int directorId) { } }
What's New in ASP.NET Web API 2.1
What's New in ASP.NET Web API 2.2
Really nice related article
ASP.NET 5 Deep Dive: Routing
While there is no expert on this, here is my understanding of how this works.
When routing attributes, the infrastructure checks the route attribute for controller actions to create route entries to add to the route table. Therefore, while you are using attribute routing, you will use [RouteAttribute] . Without this attribute, the action will by default revert to convention-based routing. RoutePrefixAttribute is an extensibility point that allows you more control over how you define your routes / Urls. Release notes say the same.
Besides my understanding and the last link, everything else was cited from MS documentation.