Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As far as I know .Net routing doesn't let you do multiple nullable parameters like that. Multiple parameters will only work if they are missing working backwards from the end and with the separator also missing so you'd get matches on</p> <pre>user/find,bob,2,live user/find,bob,2 user/find,bob user/find</pre> <p>It'd be a lot easier to use querystrings for what you're trying to do.</p> <p>Edit based on comment:</p> <p>If this is necessary then you could try doing it this way (though it's not a nice approach)</p> <p>Change your path to match</p> <p><code>{Controller}/{Action},{*parameters}</code></p> <p>Make sure to put a constraint on the action and controller so this is limited to as few as possible.</p> <p>Rename each action that would take your full list to something else, adding a standard prefix to each one would be the cleanest way, and add the <code>[NonAction]</code> attribute. Add a new method with the original name that takes a string, this string is a comma separated string of your variables. In this method split the string and return the original action passing in the values from the split.</p> <p>So you go from:</p> <pre><code>public ActionResult Find(string name, int page, string status){ //Do stuff here return View(result); } </code></pre> <p>To</p> <pre><code>public ActionResult Find(string parameters){ string name; int? page; string status; //split parameters and parse into variables return FindAction(name, page, status); } [NonAction] public ActionResult FindAction(string parameters){ //Do what you did in your previous Find action return View(results); } </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. 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