In MVC5 routing I need one situation. I have 2 namespaces with same controller name. I want to dynamically chose between controllers without conflict
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "Namespace1","Namespace2" });
In here if there are 2 controllers with same name and actions under both namespaces it gives conflict error. What I want to do is prioritize namespaces.
If both namespaces has Home.Index action I want Namespace1 take the lead instead of error. If namespace1 does not have the action I want system check for Namespace2.
I tried few ways but I don't want to use attribute routing better architecture.
We have a BaseECommerce asp.net mvc project and UI projects that are taking inherit of BaseEcommerce project. Purpose is if there is same Controller and Action in UI project use that. Else use base project.
Thanks for help.