Is there a way to do regressive route handling in ASP.NET MVC v3?
Here's my business-case example: if given a URL "www.mysite.com/faq/Index", I'd like it to check to see if a route exists for controller "FAQ", action "Index"
routes.MapRoute("Default","{controller}/{action}/{id}",
new { id = UrlParameter.Optional });
If that cannot be resolved, normally it would throw a 404 error. Instead, I'd like it to use this route:
routes.MapRoute("Content", "Content/{*contentPath}",
new { controller = "Content", action = "RenderPageByURL" });
If that fails, then it should return a 404.
I was thinking I could create a custom error handler, but this seems kludgy. Any ideas on where to start? Or is this a truly Bad Idea(TM) and I should go back to the business and tell them to use the correct path to start out with? Thanks.
Edit. To clarify, I'm not trying to see if it matches a route through simple URL matching. I'd like the routing mechanism to be intelligent enough to know if a route will be successful and find a proper controller.