title: ASP.NET MVC search route
body: <p>I setup a search route:</p>
  
  <pre><code>routes.MapRoute(
   "Search",
   "Search/{q}",
   new { controller = "Search", action = "Index" }
  );
  </code></pre>
  
  <p>The search form has an input box and a button. I want the search with a GET as below.</p>
  
  <pre><code>&lt;% using(Html.BeginForm("Index", "Search", FormMethod.Get))
  {%&gt;
      &lt;%:Html.TextBox("q")%&gt;
          &lt;span class="query-button"&gt;
          &lt;input type="submit" value="select" /&gt;&lt;/span&gt;
      &lt;% } %&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>The action on the SearchController is:</p>
  
  <pre><code>public ActionResult Index(string q)
  {
     // search logic here
  
     return View(new SearchResult(q));
  }
  </code></pre>
  
  <p>The URL becomes like this:
  <a href="http://localhost:19502/search?q=mvc+is+great" rel="nofollow noreferrer">http://localhost:19502/search?q=mvc+is+great</a></p>
  
  <p>But I want the search to be like:
  <a href="http://localhost:19502/search/mvc+is+great" rel="nofollow noreferrer">http://localhost:19502/search/mvc+is+great</a></p>
  
  <p>How do I setup the route or the Html.BeginForm </p>