title: ASP.NET route with fixed URI not mapping querystring parameters
body: <p>I am using ASP.NET MVC 4 Beta with Web API - although I believe the routing implementation has no significant differences from .NET 4.0 relevant to this question. <code>MapHttpRoute</code>, used in the code below, ships with MVC 4 and is an extension method that essentially performs the same function as MapRoute, but for WebApi controllers.</p>
  
  <p>I have a legacy web serivce method for which I want create an ASP.NET route. The method currently has following signature:</p>
  
  <pre><code>NewsItemList ListNewsItems(string category, int maxResults)
  </code></pre>
  
  <p>It should be mapped by requests whose URIs look like this:</p>
  
  <pre><code>~/news?category=finance&amp;maxResults=50
  </code></pre>
  
  <p>Neither, either or both query string parameters can be present.</p>
  
  <p>I am struggling to find a way to define a route to support this method. </p>
  
  <p>I used <code>MapHttpRoute</code> to register the route and set defaults for the controller and action values to the controller and method appropriately. Here are some templates I have tried with the outcome:</p>
  
  <ul>
  <li><code>"news"</code> captures <code>"~/news"</code> and binds to the method correctly, but
  won't capture anything with a querystring.</li>
  <li><code>"news{*query}</code> is not
  allowed because you cannot have a catch-all unless it is exclusive to
  the Uri segment</li>
  <li><code>"news{query}"</code> captures the query string but doesn't
  bind to the method</li>
  </ul>
  
  <p>I'm looking for a way forwards that isn't too radical a departure as this is an edge-case in the application. The solution has to fit in with many other existing routes. Ideally I'd like to avoid going down the Uri re-writer path as well.</p>