Cascading MVC controllers with CatchAll Routes

Cascading MVC controllers with CatchAll Routes

I have an MVC app which has its routes defined with the final route being a catch all route to a "PageController" for a database driven collection of pages. What I want to achieve is to be able to plugin to the app a second controller to the catch all route which the first controller passes on to if it does not find the url recieved in the database.

Effectively I want to queue up controllers with catch all actions:

public ActionResult PageCatchall(string url) {     var page = repository.Get<Page>(string url);     if (page != null)     {         // Handle the request        return View(page)     }     // Otherwise pass to a new controller     ???? } 

Anyone have any good ideas as to how to solve this? I have tried RedirectToAction but that requires that the next controller has a different route to the action. I have tried ActionInvoker but this failed to work the way I did it.

How to get parameters out of an ascx back to the main aspx page


Display Friendly Date, Numbers [duplicate]
While I would avoid complex routing like this one, I guess best thing to did is to use custom route constraint this uses cached list of pages to match correct route (have done this with success).. Maintaining the query string in ASP.Net MVC I'll leave exact implementation for You as an exercise. “this” in function parameter;o). Failing to connect to Database due to database in recovery
Partial view postback from a standard Html form with MVC

50 out of 100 based on 55 user ratings 880 reviews