title: How Do I Support Empty RouteAttribute in Web API?
body: <p>I have this class:</p>
  
  <pre><code>[RoutePrefix("api/v2/Foo")]
  public class SomeController : BaseController
  {
      [Route("")]
      [HttpGet]
      public async Task&lt;HttpResponseMessage&gt; Get(SomeEnum? param)
      {
          //...
      }
  }
  </code></pre>
  
  <p>I want to call it via:
  <code>api/v2/Foo?param=Bar</code>
  but it doesn't work.</p>
  
  <p>If I change the routing attribute thusly to include something in the RouteAttribute:</p>
  
  <pre><code>    [Route("SomeRoute")]
      [HttpGet]
      public async Task&lt;HttpResponseMessage&gt; Get(SomeEnum? param)
      {
          //...
      }
  </code></pre>
  
  <p>...then I <i>can</i> call
  <code>api/v2/Foo/SomeRoute?param=Bar</code>
  , but that isn't what I want.</p>
  
  <p>How do I get the first circumstance to work?</p>
  
  <p>EDIT:
  Domas Masiulis steered me toward the answer: the above scenario DOES work, it's just that a default global routing screwed things up. I solved the issue by adding a separate default routing that matched our convention...</p>
  
  <pre><code>    public static void RegisterRoutes(RouteCollection routes)
      {
          //ADDING THIS FIXED MY ISSUE
          routes.MapHttpRoute(
              name: "API Default",
              routeTemplate: "api/v2/{controller}/{id}",
              defaults: new { id = RouteParameter.Optional }
          );
  
          //SOURCE OF THE ORIGINAL PROBLEM
          routes.MapRoute(
             "Default", // Route name
             "{controller}/{action}/{id}", // URL with parameters
             new { controller = "Administration", action = "Index", id = UrlParameter.Optional } // Parameter defaults
         );
      }
  </code></pre>