I am creating an MVC application in asp.NET for a web portal. I prepared a series of controllers and matched all the paths that are not related to it to the page controller that displays the corresponding page.
My default route works as follows:
routes.MapRoute( "Default", "{level1}/{level2}/{level3}", new { controller = "Page", action = "Index", level1 = "home", level2 = "", level3 = "" } );
But this is a fixed width, it will only take up to three levels. In addition, I would like to control the actions added to the path, for example, โeditโ and โdeleteโ. Is it possible?
company/about/who_we_are/staff -> Controller: Page, Action: Index, Parms: company/about/who_we_are/staff company/about/who_we_are/staff/edit -> Controller: Page, Action: Edit, Parms: company/about/who_we_are/staff company/edit -> Controller: Page, Action: Edit, Parms: company
Or is there a better way to simulate this? All page paths are in the database, so they change dynamically.
source share