O'Reilly logo

ASP.NET MVC 2 Cookbook by Richard Kimber, Andrew Siemer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Supporting content hierarchies with a custom RouteHandler

In this recipe, we will take a look at a great use of the wildcard route. We will show how to make a single route that handles multiple URLs from /Sports/Football/Padding/Rawlings/ShoulderPads to /Aquariums/100-Gallon/Stands/Marineland/Monterey-Stand. We will also take this concept one step further by supporting additional commands other than just a Get content type scenario. We will also add support Delete, Post, and Edit, so that our single route can support an inline style content management solution.

How to do it...

  1. Start by creating a new MVC application.
  2. Then open up the Global.asax file. In the routing section, add a new route definition to the bottom of the list. This route will not ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required