Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The parameters in your routes <code>{roleId}</code>, <code>{applicationName}</code> and <code>{roleName}</code> don't match the parameter names in your action methods. I don't know if that matters, but it makes it tougher to figure out what your intention is.</p> <p>Do your itemId's conform to a pattern that could be matched via regex? If so, then you can add a restraint to your route so that only url's that match the pattern are identified as containing an itemId.</p> <p>If your itemId only contained digits, then this would work:</p> <pre><code>routes.MapRoute("AssignRemove", "Items/{action}/{itemId}", new { controller = "Items" }, new { itemId = "\d+" } ); </code></pre> <p>Edit: You could also add a constraint to the <code>AssignRemovePretty</code> route so that both <code>{parentName}</code> and <code>{itemName}</code> are required.</p> <p>Edit 2: Also, since your first action is just redirecting to your 2nd action, you could remove some ambiguity by renaming the first one.</p> <pre><code>// Method #1 public ActionResult AssignRemovePretty(string parentName, string itemName) { // Logic to retrieve item's ID here... string itemId = ...; return RedirectToAction("Assign", itemId); } // Method #2 public ActionResult Assign(string itemId, string searchTerm, int? page) { ... } </code></pre> <p>Then specify the Action names in your routes to force the proper method to be called:</p> <pre><code>routes.MapRoute("AssignRemove", "Items/Assign/{itemId}", new { controller = "Items", action = "Assign" }, new { itemId = "\d+" } ); routes.MapRoute("AssignRemovePretty", "Items/Assign/{parentName}/{itemName}", new { controller = "Items", action = "AssignRemovePretty" }, new { parentName = "\w+", itemName = "\w+" } ); </code></pre>
    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. 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