tags:

views:

75

answers:

2

Hello, I am developing a website that has nested categories. I would like the categories to be in the url such as something like this

http://www.dmoz.org/Computers/Programming/Component_Frameworks/NET/Chats_and_Forums/

as you can see in the above url the categories are in the url itself. How can I develop something like this in asp.net mvc?

+1  A: 

You could catch them as parameters {*id} then parse them in the controller.

Dr. Zim
A: 

Look up URL Routing:

As per the above, you'll just need to add a route(s) to the routing table using placeholders in your URLs for your categories / sub-categories etc. This means any links to your pages, or anyone directly writing in the URL will go to the routing table and try to match it up - make sure the default 'catch-all' route is last in your list of routes defined.

When you're building up these URLs for links etc to click in your views, then I would probably create a Html helper that builds up a string with your controller/category/sub-category syntax.

Michael