title: Question about custom routing in ASP.NET MVC
body: <p>I have to admit in advance that I'm quite new to MVC, I've been going through the resources at www.asp.net/mvc, but I was wondering if you guys could help me with something.</p>
  
  <p>I have been asked to create a ASP.NET version of an existing PHP website, this website has a huge number of existing links to it in a particular format, which I have to replicate in due to the amount of work to change all the existing links would be far too much.</p>
  
  <p>The format of the existing links is;</p>
  
  <pre><code>/([A-Za-z0-9]{14})/([A-Za-z0-9_-]*)
  </code></pre>
  
  <p>My attempt at creating a custom route doesn't appear to be working. What I have done is change the RegisterRoutes method in Global.asax.cs file to be;</p>
  
  <pre><code>public static void RegisterRoutes(RouteCollection routes)
  {
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
      routes.MapRoute(
          "ExistingLink",
          "{LinkId}/{Title}",
          new {controller="ExistingLinkController", action="Index"},
          new {LinkId = @"([A-Za-z0-9]{14})", Title = @"([A-Za-z0-9_-]*)"});
  
      routes.MapRoute(
          "Default", // Route name
          "{controller}/{action}/{id}", // URL with parameters
          new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
      );
  
  }
  </code></pre>
  
  <p>I have also created the 'ExistingLinkController' with an 'Index' action of;</p>
  
  <pre><code>public ActionResult Index(string LinkId, string Title)
  {
      ViewData["LinkId"] = LinkId;
      ViewData["Title"] = Title;
      return View();
  }
  </code></pre>
  
  <p>And a view which contains the code;</p>
  
  <pre><code>&lt;h2&gt;LinkId: &lt;%: ViewData["LinkId"] %&gt;
  &lt;/h2&gt;Title: &lt;%: ViewData["Title"] %&gt;&lt;/h2&gt;
  </code></pre>
  
  <p>But when I try to go to;</p>
  
  <blockquote>
    <p>/55a3ef90c4b709/This-is-just-a-test_0-9</p>
  </blockquote>
  
  <p>I get the following error;</p>
  
  <blockquote>
    <p>Description: HTTP 404. The resource
    you are looking for (or one of its
    dependencies) could have been removed,
    had its name changed, or is
    temporarily unavailable.  Please
    review the following URL and make sure
    that it is spelled correctly.</p>
    
    <p>Requested URL:
    /55a3ef90c4b709/This-is-just-a-test_0-9</p>
  </blockquote>
  
  <p>I was wondering whether anyone can see what I am doing wrong and possibly point me in the right direction, perhaps pointing at the bit of code that's wrong if its a simple problem or pointing me to a article that will help me get a better understanding if I've got the wrong end of the stick with this routing stuff.</p>
  
  <p>Thanks for any help in advance</p>
  
  <p>Satal :D</p>