Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing the greedy route parameter in the middle of a route definition
    text
    copied!<p>I'm trying to create routes which follow the structure of a tree navigation system, i.e I want to include the entire path in the tree in my route. So if I had a tree which looked like this</p> <ul> <li>Computers <ul> <li>Software <ul> <li>Development</li> <li>Graphics</li> </ul></li> <li>Hardware <ul> <li>CPU</li> <li>Graphics cards</li> </ul></li> </ul></li> </ul> <p>Then I would like to be able to have routes that looks like this</p> <ul> <li>site.com/catalog/computers/software/graphics</li> </ul> <p>This, on it's own is not hard and can be caught by a route which looks like this</p> <ul> <li>catalog/{*categories}</li> </ul> <p>However I want to be able to add the product information at the end of that URL, something like this</p> <ul> <li>site.com/catalog/computers/software/graphics/title=Photoshop</li> </ul> <p>Which would mean I would requite routes that were defined like the following examples</p> <ul> <li>site.com/{*categories}/title={name}</li> <li>site.com/{*categories}</li> </ul> <p>However the first of these routes are invalid since nothing else can appear after a greedy parameter such as {*categories} so I'm a bit stuck. I've been thinking of implementing regex routes or perhaps use IRouteContraint to work my way around this but I can't think of a decent solution that would enable me to also use the <strong>Html.ActionLink(...)</strong> method to generate outbount URLs which filled in both {*categories} and {name}</p> <p>Any advice is greatly apprechiated!</p> <p><em>Some of you may have seen a similar question by me yesterday but that was deleted, by me, since I've since given it more thought and the old question contained incomplete descriptions of my problem</em></p> <p><strong>UPDATE 2008/11/26</strong> I posted the solution at <a href="http://thecodejunkie.blogspot.com/2008/11/supporting-complex-route-patterns-with.html" rel="nofollow noreferrer">http://thecodejunkie.blogspot.com/2008/11/supporting-complex-route-patterns-with.html</a></p>
 

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