title: ASP.NET MVC 5 Attribute Routing Failing To Resolve Route Correctly
body: <p>I have the following routes in my controller. One Get and two post actions. All have the same action name. The two post actions are differentiated using the MultipleButton attribute as explained <a href="https://stackoverflow.com/questions/442704/how-do-you-handle-multiple-submit-buttons-in-asp-net-mvc-framework">here</a>:</p>
  
  <pre><code>[RoutePrefix("incidents")]
  public sealed class IncidentsController : Controller
  {    
      [HttpGet, Route("action/{id:int?}/{error?}")]
      public async Task&lt;ActionResult&gt; Action(int? id, string error = null)
  
      [HttpPost, Route("action"), ActionName("Action"), ValidateAntiForgeryToken]
      [MultipleButton(Name = "action", Argument = "Accept")]
      public async Task&lt;ActionResult&gt; ActionAccept(IncidentActionViewModel incident)
  
      [HttpPost, Route("action"), ActionName("Action"), ValidateAntiForgeryToken]
      [MultipleButton(Name = "action", Argument = "Reject")]
      public async Task&lt;ActionResult&gt; ActionReject(IncidentActionViewModel incident)
  }
  
  @Url.Action("Action", "Incidents", new { id = 10 })
  </code></pre>
  
  <p>The above route gets rendered as shown below. Navigating to this URL works but if I change the 'id' parameter from Nullable to int I start to get errors.</p>
  
  <blockquote>
    <p>/incidents/action?id=10</p>
  </blockquote>
  
  <p>It should be rendering as shown below and I should not get errors if I change the 'id' parameter to type int:</p>
  
  <blockquote>
    <p>/incidents/action/10</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here are my route registration details:</p>
  
  <pre><code>routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
  routes.MapMvcAttributeRoutes();
  
  routes.MapRoute(
      name: "Default",
      url: "{controller}/{action}/{id}",
      defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });
  </code></pre>