How do I do multipled level routes best in MVC

Posted by Lilja on Stack Overflow See other posts from Stack Overflow or by Lilja
Published on 2010-12-15T22:28:25Z Indexed on 2010/12/25 4:54 UTC
Read the original article Hit count: 288

I have a site where I would like an URL like:

/Some maincategory name/{id}/Some subcategory name/{id}/Some item name/{id}

I include the IDs of each level since the name is not unique. This is doable but I have to create a new routing for each level. My Html.ActionLink also looks nasty.

Each level has it's own controller since the levels are completely different. The URLs could be something like this:

_/Birds/2/Waders/4/Flamingos/23_  
_/Mammals/5/Dogs/23/Longeared/25/Somedog/76_  
_/Insects/7/Spiders_

This is just an example and not what I'm going to use. My applications has nothing to do with animals.

Is there a good way of doing this or should I use the standard routing instead?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc