home / software / tips and tricks / How to add multiple RoutePrefixes on a controller in MVC, using Attribute routing?

How to add multiple RoutePrefixes on a controller in MVC, using Attribute routing?

Updated:  06/23/2015 15:06 PM
Author:  Shiju Mathews

Status:    Resolved.


Routing is how ASP.NET MVC matches a URI to an action. MVC 5 supports a new type of routing, called attribute routing. As the name implies, attribute routing uses attributes to define routes. Attribute routing gives you more control over the URIs in your web application.

You can set a common prefix for an entire controller by using the [RoutePrefix] attribute:


If you want to handle multiple routes in one controller, use regular expressions.
Tags: How to add multiple RoutePrefixes on a controller in MVC using Attribute routing?
Updated on: October 2024