Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is the solution which solves my given issue - hope it solves someone elses.</p> <p>As mentioned in my comment to Robert Harvey, all I actually need is another route which doesn't use the first two or three components as the controller, action and id, but instead takes those values from later on - if you hang this off of a static value in the route as well, its much easier to do.</p> <p>So, here is the url I decided on to simplify the route:</p> <pre><code>/{subjectarea}/{subject}/related/{tightlyrelatedsubject}/{tightlyrelatedsubjectvariables}/{tightlyrelatedsubjectaction} </code></pre> <p>The route which satisfies this URL is as follows:</p> <pre><code> routes.MapRoute( "RelatedSubjects", "{parentcontroller}/{parentsubject}/related/{controller}/{id}/{action}", new { controller = "shoes", action = "view", id = "all" } ); </code></pre> <p>On the subsequent controller action, I can ask for parameter values for parentcontroller and parentsubject so I can filter out the related item to just be specific to the given parent subject - problem solved!</p> <p>This route needs to be above the ones which just deal with the first two values, otherwise you run the risk of another route map hijacking the request.</p> <p>I could do this entirely without the /related/ static portion as the route could easily match on number of values alone, and infact I may indeed do so - however, I consider it better for later administration if there is a static item in there to confirm the use of the route. </p> <p>I hope this helps someone!</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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