Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Why does the first URL in the new list still have "Customer". I assume that's a typo and you meant:</p> <ul> <li><a href="http://example.com/List" rel="noreferrer">http://example.com/List</a></li> <li><a href="http://example.com/List/Page/2" rel="noreferrer">http://example.com/List/Page/2</a></li> <li><a href="http://example.com/List" rel="noreferrer">http://example.com/List</a></li> <li><a href="http://example.com/View/8372" rel="noreferrer">http://example.com/View/8372</a></li> <li><a href="http://example.com/Search/foo/Page/5" rel="noreferrer">http://example.com/Search/foo/Page/5</a></li> </ul> <p>The following routes work for me:</p> <pre><code>routes.MapRoute( "CustomerSearch" , "Search/{query}/Page/{page}" , new { controller = "Customer", action = "Search" } ); routes.MapRoute( "CustomerGeneric" , "{action}/{id}/Page/{page}" , new { controller = "Customer" } ); //-- Default Route routes.MapRoute( "Default", "{action}/{id}", new { controller = "Customer", action = "Index", id = "" } ); </code></pre> <p>How are you generating your links. Since the Controller is no longer in the URL of your route (aka, you don't have "{controller}" in the route URL), but it's a default value, you need to make sure to specify the controller when generating routes.</p> <p>Thus instead of </p> <pre><code>Html.ActionLink("LinkText", "ActionName") </code></pre> <p>do</p> <pre><code>Html.ActionLink("LinkText", "ActionName", "Customer") </code></pre> <p>Why? Suppose you had the following routes.</p> <pre><code>routes.MapRoute( "Default", "foo/{action}", new { controller = "Cool" } ); routes.MapRoute( "Default", "bar/{action}", new { controller = "Neat" } ); </code></pre> <p>Which route did you mean when you call this?</p> <pre><code>&lt;%= Html.ActionLink("LinkText", "ActionName") %&gt; </code></pre> <p>You can differentiate by specifying the controller and we'll pick the one that has a default value that matches the specified one.</p>
 

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