title: Routing legacy requests with and without querystring
body: <p>(Before starting: I am aware of <a href="https://stackoverflow.com/q/7395841">this</a> and <a href="https://stackoverflow.com/q/817325">this</a>. I'd like to find a more concise solution -if possible- for a slightly more specific problem)</p>
  
  <p>I'm rewriting an old Webforms app in MVC. As usual, no permalinks should be broken.</p>
  
  <p>I'm using standard <code>{controller}/{action}/{id}</code> routes. Legacy paths are usually <code>SomePage.aspx?ID=xxx</code>, and I have one particular case where <code>Foo.aspx</code> is a list of <code>Bar</code> (new URL: <strong>/Bar</strong> or <strong>/Bar/Index</strong>) and 
   <code>Foo.aspx?ID=xxx</code> is the <code>Bar</code> detail (new URL: <strong>/Bar/View/xxx</strong>)</p>
  
  <p>One possible workaround is adding the following before the Default <code>MapRoute</code>:</p>
  
  <pre><code>routes.MapRoute("Bar View", "Foo.aspx",
                  new { controller = "Bar", action = "View" });
  </code></pre>
  
  <p>And then defining the corresponding action in BarController:</p>
  
  <pre><code>public ActionResult View(int? id)
  {
      if (id == null)
          return RedirectToAction("Index");
      return View();
  }
  </code></pre>
  
  <p>There are two problems with this:</p>
  
  <ul>
  <li>Now, if I create an ActionLink, it uses the legacy format</li>
  <li>I'd like to handle this in the routes; making the id nullable and redirecting in the controller is just wrong</li>
  </ul>
  
  <p>I'm fine with mapping the legacy URLs by hand (I don't need a generic solution and there are only about 8 pages)</p>
  
  <p>This is a new project, so I'm not tied to anything.</p>