Reputation: 71
I have view names like Folder-One/Page-One.aspx I want to do a base controller implimentation that all request go to one Base Controller, that returns the view based on the context. Obviously still keeping the .aspx in the path
I have folders like getting-started/application-faq.aspx but what I want to do is I want to create 1 controller that does all the return views, as the pages are basicly static html
Is this possible?
Upvotes: 3
Views: 155
Reputation: 5403
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{view}.aspx", // URL with parameters
new { controller = "Base", action = "ChooseView" ,view ="Page-One"}
);
and your action can choose view to show :
publict ActionResult ChooseView (string viewName)
{ return View("~/Views/"+viewName); }
Upvotes: 2