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