Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So you're looking for something like</p> <pre><code>public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Content_default", "Content/{id}/{optional}", new { controller = "ItemController", action = "TheActionYouWantThisToAllRouteTo" } } </code></pre> <p>This would default everything to one controller and action method (which you have to specify in your instance). You can then get the data like so:</p> <pre><code>public ActionResult TheActionYouWantThisToAllRouteTo (string id, string optional) { // Do what you need to do } </code></pre> <p>The way the routes are setup, you can name the pieces of information you want in a URL by wrapping it in a pair of <code>{ }</code> curly braces. If you'd rather the name of <code>optional</code> to be <code>isTestData</code> then you would just change the route to read <code>"Content/{id}/{isTestData}"</code>.</p> <p>Note: <em>Since you didn't specify the default action method you want this to route to, I substituted it with <code>TheActionYouWantThisToAllRouteTo</code>. Change that string to read the action method you want this to all go to. This also means you can't have a "regular" controller named ContentController, either.</em></p> <p><strong>Edit</strong></p> <p>Stephen Walther has a good blog post on custom route constraints. <a href="http://stephenwalther.com/blog/archive/2008/08/07/asp-net-mvc-tip-30-create-custom-route-constraints.aspx" rel="nofollow">It can be found here</a>. It should be a good start to get done what you need.</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