i have quite big ASP.NET MVC 2 application (multiple areas, each with own routing registration) using routes like this :
/Item/12345/Detail – where 12345 is the ID of the item. The whole application just rely on that numeric IDs. But now there is an requirement (seo stuff) to make URLs look like this :
/Item/item-unique-string-name/Detail
I would love to handle this globally in some high level – for example load numeric ID before route evaluation and “replace” it in route data. But i am not sure what is the right spot for such a hack – custom MvcHandler, custom IRouteHandler, somewhere else ? any ideas about this ? 🙂
Hey, i figured it out by myself eventually,
all i had to do was override execute method of my BaseController like this :
So no hacking of routing needed after all 🙂