Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC URL Routing problem
    primarykey
    data
    text
    <p>i have defined a route as below:</p> <pre><code>context.MapRoute("SearchEngineWebSearch", "search/web/{query}/{index}/{size}", new { controller = "search", action = "web", query = "", index = 0, size = 5 }); </code></pre> <p>and action method to handle request match with that:</p> <pre><code>public System.Web.Mvc.ActionResult Web(string query = "", int index = 0, int size = 5) { if (string.IsNullOrEmpty(query)) return RedirectToRoute("SearchEngineBasicSearch"); var search = new Search(); var results = search.PerformSearch(query, index, size); ViewData["Query"] = query; if (results != null &amp;&amp; results.Count() &gt; 0) { ViewData["Results"]= results; return View("Web"); } else return View("Not-Found"); } </code></pre> <p>and form to sent parameter to action method:</p> <pre><code>&lt;% using (Html.BeginForm("Web", "Search", FormMethod.Post)) { %&gt; &lt;input name="query" type="text" value="&lt;%: ViewData["Query"]%&gt;" class="search-field" /&gt; &lt;input type="submit" value="Search" class="search-button" /&gt; &lt;input type="hidden" name="index" value="2" /&gt; &lt;input type="hidden" name="size" value="2" /&gt; &lt;%} %&gt; </code></pre> <p>now after click on submit and sending value to action method all route values updated but url values still is equals to first time of sending parameter. for example if i sent for first time request such as <a href="http://localhost/search/web/google" rel="nofollow noreferrer">http://localhost/search/web/google</a> and for next time <a href="http://localhost/search/web/yahoo" rel="nofollow noreferrer">http://localhost/search/web/yahoo</a>, query parameter which passed to action method is yahoo but url after postback is <a href="http://localhost/search/web/google" rel="nofollow noreferrer">http://localhost/search/web/google</a> still!</p> <p>can anybody help me plz? ;)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload