title: ASP.Net MVC Routes not working properly
body: <p>We have several routes in our Global.asax.cs file, but one of them is not apparently being used.</p>
  
  <pre><code>// Search (NOT working).
  routes.MapRoute(
           "Search",
           "search/{query}",
           new { controller = "Search", action = "Index" });
  
  // Homepage (I believe the problem could be here, but not sure).
  routes.MapRoute(
           "MainIndex",
           "{language}",
           new { controller = "Main", action = "Index", language = string.Empty });
  </code></pre>
  
  <p>When we do a search in the search form which action attribute is "/Search", the user is sent to the homepage and the URL in the address bar is "/Search?query=example+search".</p>
  
  <p>The form action attribute is built in using this code:</p>
  
  <pre><code>&lt;form id="form1" action="&lt;%= Url.Action("Index", "Search") %&gt;"&gt;
  </code></pre>
  
  <p>Seems right to me, but the action name should be "/search" instead of "/Search", right?</p>