title: ASP.NET MVC 3 Url.Action matching
body: <p>I have the following two routes defined:</p>
  
  <pre><code>routes.MapRoute(null, "" // ~/  
                  ,new { controller="Products", action="List", page=1 });
  
  routes.MapRoute(null, "{category}/Page{page}" // ~/CategoryName/Page21  
                  , new { controller = "Products", action = "List", page = 1 }
                  , new { page = @"\d+" } //page must be numerical
                  );
  </code></pre>
  
  <p>I am generating a URL using this code in the view being used by ProductsController: <code>Url.Action("List", new {page=p, category=Model.CurrentCategory})</code> </p>
  
  <p>With the current configuration, I get this URL: <strong>/Riding/Page2</strong> </p>
  
  <p>However, if I omit the default <strong>page</strong> parameter from the first route, I get this URL instead: <strong>/?category=Riding&amp;page=2</strong></p>
  
  <p>It seems to me that <code>Url.Action()</code> can match both routes and is making a decision to use the second route if I have the default <strong>page</strong> parameter specified in the first route but is choosing to use the first route if that parameter is omitted.  </p>
  
  <p>Given that I am supplying a value for <strong>page</strong> parameter, why would eliminating it from the route's defaults make a difference in the URL I get back?    </p>
  
  <p>Thanks!</p>