title: How do I use constraints in ASP.net MVC 4 RouteConfig.cs?
body: <p>I'm trying to get some routing constraints working using the latest asp.net mvc 4 architecture. Under App_Start there is a file called RouteConfig.cs.</p>
  
  <p>If I remove the constraints section from my example below, the url works. But I need to add some constraints so that the url doesnt match on everything.</p>
  
  <p>Should work: /videos/rating/1</p>
  
  <p>Shold NOT work: /videos/2458/Text-Goes-Here</p>
  
  <p>This is what I have:</p>
  
  <pre><code>//URL: /videos/rating/1
  routes.MapRoute(
      name: "Videos",
      url: "videos/{Sort}/{Page}",
      defaults: new { controller = "VideoList", action = "Index", Sort = UrlParameter.Optional, Page = UrlParameter.Optional },
      constraints: new { Sort = @"[a-zA-Z]", Page = @"\d+"}
  );
  </code></pre>