title: ASP.NET MVC custom routes with optional args
body: <p>I want a Route with two optional args; I thought the following would work:</p>
  
  <pre><code>routes.MapRoute(
      "ProductForm",
      "products/{action}/{vendor_id}_{category_id}",
      new { controller = "Products", action = "Index", vendor_id = "", category_id = "" },
      new { action = @"Create|Edit" }
  );
  </code></pre>
  
  <p>But it only works when both <code>vendor_id</code> and <code>category_id</code> are provided; using <code>RouteDebug</code> I see that <code>/products/create/_3</code> doesn't trigger my route, so I added other two routes:</p>
  
  <pre><code>routes.MapRoute(
      "ProductForm1",
      "{controller}/{action}/_{category_id}",
      new { controller = "Home", action = "Index", category_id = "" },
      new { controller = "Products", action = @"Create|Edit" }
  );
  
  routes.MapRoute(
      "ProductForm2",
      "{controller}/{action}/{vendor_id}_",
      new { controller = "Home", action = "Index", vendor_id = "" },
      new { controller = "Products", action = @"Create|Edit" }
  );
  </code></pre>
  
  <p>So, the questions: </p>
  
  <ul>
  <li><p>Is using three routes the only way to make a route with optional args?</p></li>
  <li><p>Are these URLs ok or not, that is, would you suggest a better way to do this?</p></li>
  </ul>