We should be allosed to use the {action} token when specifying routes so we do not have to repeat the method name everywhere...
Current:
[Route("SomeSuperAction/{id:int}")]
public virtual ActionResult SomeSuperAction(int id)
{
Proposed:
[Route("{action}/{id:int}")]
public virtual ActionResult SomeSuperAction(int id)
{
Comments: We intentionally don't support the use of {action} as a parameter to prevent confusion. What you're suggesting is one coherent way that {action} could work in attribute routes, but without special logic to in the framework to support it, a scenario like: ``` [Route("{action}/{id:int}")] //How can I do this? public ActionResult SomeSuperAction(int id) { return View(); } ``` would match "/5", "SomeSuperAction/5", and "SomeOtherAction/5". The match for "/5" is possible because the {action} parameter already carries with it a default value of 'SomeSuperAction' in this case, which is needed to do the correct thing in URL generation. However, this behavior is customizable via IDirectRouteFactory. You can create your own attribute to replace [Route] that implements the logic you want. This should do what you're asking for, just use [ActionRoute] instead of [Route] ``` using System; using System.Linq; using System.Web.Mvc.Routing; namespace MVCTesting { [AttributeUsage(AttributeTargets.Method)] public class ActionRouteAttribute : Attribute, IDirectRouteFactory { public ActionRouteAttribute(string template) { Template = template; } public string Template { get; private set; } public RouteEntry CreateRoute(DirectRouteFactoryContext context) { var action = context.Actions.Single(); // replace the {action} token in the url template with the actual action name var replaced = Template.Replace("{action}", action.ActionName); var builder = context.CreateBuilder(replaced, null); return builder.Build(); } } } ```