Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The current request values are <strong>always</strong> used. The difference between <code>Url.Action</code> and <code>Url.RouteUrl</code> (which is used by <code>RedirectToRoute</code>) is that <code>Url.Action</code> overrides null values for <code>controller</code> and <code>action</code> with the current request values (which are never null in MVC), and <code>Url.RouteUrl</code> does not (it leaves them null). Note that a null value is not the same as a non-existent, ommited or undefined value.</p> <p>Check out <a href="http://maxtoroq.blogspot.com/2012/04/putting-aspnet-routing-to-test.html" rel="nofollow">this post</a> I wrote about routing:</p> <blockquote> <p>The UrlHelper.Action set of methods take actionName and controllerName string parameters. Calling these methods can be translated to something equivalent to <code>Url.RouteUrl(new { action = actionName, controller = controllerName })</code>. As we verified earlier in <em>Cannot use null or empty string for default value without parameter</em>, using null for actionName and/or controllerName can result in failing to match the desired route. For this reason Url.Action uses the current request controller and action values whenever null is used for actionName and/or controllerName.</p> </blockquote> <p><hr/> To clarify, the first example matches Route1 because:</p> <ol> <li>The route doesn't have tokens, which means it doesn't require values to match.</li> <li>The value for action matches the default value.</li> <li>The code doesn't provide a value for controller. If a value had been provided it would need to be "Account" to match.</li> </ol> <p>On the second example My is used as value for controller, taken from the current request values because the route contains a controller token and a value is not provided.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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