Define your routes using attributes on action methods in ASP.NET MVC and Web API
C# ASP Puppet
Clone or download
Pull request Compare This branch is 232 commits behind mccalltd:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Please refer to the wiki pages for documentation.

If you encounter any issues using this library, please log them in the issue tracker. Thanks.



  • #81 – Updated Web API references from Beta to RC. Fixed a few compilation erros due to switch.


  • Fixed bug in RestfulHttpMethodContraint for web projects. Was not honoring http method overrides in request headers, forms, or query collections.
  • Implemented one of Sam Saffron’s performance enhancements for speeding up route table lookups.
  • #82 – added OPTIONS verb to GET/PUT/POST/DELETE attributes in web API attributes.
  • Removed references to MVC2, now using MVC3.


  • #71 – fixed bug in regex pattern matching when multiple url parameters existed for a single url segment.


  • #65 – fixed bug introduced in v2.* that arises when using the RouteAttribute on actions without specifying a verb.



  • #63 – BREAKING CHANGE! Fixed issue with ambigous routes in MVC controllers. All prior versions worked from AttributeRouting.VERBAttribute, and these have moved into MVC and Web API specific versions to handle disambiguation: AttributeRouting.Web.Mvc.VERBAttribute and AttributeRouting.Web.Http.VERBAttribute.


  • #60 – can now override global configuration settings for UseLowercaseRoutes, PreserveCaseForUrlParameters, and AppendTrailingSlash via similarly named properties on the route attributes (GET, POST, PUT, DELETE, and Route).


  • #57, #52 Added support for Web API, both Web-hosted and Self-hosted
    – Added new Nuget packages, AttributeRouting.WebApi and AttributeRouting.WebApi.Hosted


  • #53 – added config setting for resolving the current UI culture name when constraining inbound requests.
  • #56 – Added Configuration to inherit actions defined on a base controller
  • #54 – fixed null ref exception when hitting routes.axd


  • Can now choose to preserve the case for url parameters
  • Added logic and config option to constrain routes by the culture name of the current thread. The route is considered when: 1) no translations exist for the route; 2) it is translated for the current UI culture; 3) it is translated for the neutral culture when no translation exists for the specific culture. This constraint logic follow the logic used when choosing the translation to use when generating outbound routes.


  • Made modification to configuration of route translation providers. Used to be config.TranslationProvider = …, now it is config.AddTranslationProvider(). This allows adding multiple providers. THIS IS A BREAKING CHANGE. Please see the wiki page regarding [[Localization]].


  • Added localization support via TranslationProvider configuration option.
  • Added support for mapping areas to static subdomains.


  • Fixed logic in getting values from form and querystring collections, so that no errors are thrown during “potentially dangerous requests” when System.Web.Helpers is available.
  • Added ability to append trailing slash to URL path of outgoing URLs.
  • Support custom route handler factory.


  • Removed reference to System.Web.WebPages in AR. Now, when checking for form or query values for the http method override, AR is dynamically checking for System.Web.WebPages, and if found, will use the Unvalidated collection rather than request.form or request.querystring.


  • Fixed bug I introduced when trying to exclude route params from lowercase route generation. Will try again later.


  • Issue 18 – allowed route params case to be preserved while lowercasing the area, controller, and action.
  • Identify controllers that do not inherit from Controller
  • Add strongly typed way to specify allowed HTTP methods for RouteAttribute


  • Issue 24 – fixed null reference in GetHttpMethod extension when inspecting routes in unit tests (ie: mocked http contexts).


  • Used System.Web.WebHelpers to sniff the form and querystring collections hanging off the request for an http method override without triggering request xss validation.
  • Marked configuration object’s AddRemainingScannedRoutes method as obsolete beacause it is … obsolete.


  • Fixed bug that occured when building route urls that have areas or prefixes that start with the route url, even when it is only a partial match.
  • Fixed reflection logic for finding action methods. Used to restrict to public instance methods that returned type assignable to ActionMethod; now simply returns public instance methods, in line with the true definition of an action method in MVC.


  • Modified the base RouteAttribute to allow it to work without an http method constraint, so that an action can respond to any verb.
  • Added ability to specify optional parameter token (?) at either beginning or end of url param.
  • Added ability to specify route defaults inline with the url parameter.
  • Added ability to specify regex route constraints inline with the url parameter.


  • Fixed bug in base route attribute that disallowed URLs like Somewhere/{*pathInfo}, barfing on the asterisk.


  • Added HEAD constraint to GET attribute so that all GET routes will respond to HEAD requests as well.
  • Fixed bug when testing whether a route starts with an area url applicable to the route. Previously it was comparing against the area name, which was recently made overridable, and part of this logic was not updated.
  • Fleshed out XML doc comments.
  • Fixed bug in ordering of routes for an action when using a RouteConvention.
  • Added T4 CodeTemplates for controllers and views to swap with the defaults provided in MVC projects.
  • Fixed bug in applying global route constraints — when more than one url parameter matches the specified regex, only the first one matched has the constraint applied. Corrected this so that each matched url parameter has the constraint applied.


  • Added IsAbsoluteUrl property to the RouteAttributes, which prevents the RouteAreaAttribute and RoutePrefixAttribute from prefixing the URL for a route. This can be handy for legacy URL support.
  • Added Precedence property to the RouteAtrributes, which allows you to specify the precedence of a route among all the routes defined for the controller.
  • New and improved output from the LogRoutesHandler.
  • New RouteConventionAttribute, which allows you to create your own convention-based route generator for actions within a controller. There is also a RestfulRouteConventionAttribute, which automatically creates RESTful routes for standard actions in your controller.