Can I Generate ASP.NET MVC Routes From A Sitemap?

- 1 answer

I'm thinking of learning the ASP.NET MVC framework for an upcoming project. Can I use the advanced routing to create long URLs based on the sitemap hierarchy?

Example navigation path:

Home > Shop > Products > Household > Kitchen > Cookware > Cooksets > Nonstick

Typical (I think) MVC URL:

Desired URL:

Can I do this?



Zack, if I understand right you want unlimited depth of the subcategories. No biggie, since MVC Preview 3 (I think 3 or 4) this has been solved.

Just define a route like


for an url such as :

you should have a ShopController with a Products action :

public class ShopController : Controller
    public ActionResult Products(string categoryPath)
        // the categoryPath value would be
        // "household/kitchen/cookware/cooksets/nonstick". Process it (for ex. split it)
        // and then decide what you do..
        return View();