Different controllers with the same name in two different areas results in a routing conflict
- by HackedByChinese
I have two areas:
ControlPanel and Patients.
Both have a controller called ProblemsController that are similar in name only. The desired results would be routes that yield /controlpanel/problems = MyApp.Areas.ControlPanel.Controllers.ProblemsController and /patients/problems = MyApp.Areas.Patients.Controllers.ProblemsController.
Each has routes configured like this:
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"**Area Name Here**_default",
"**Area Name Here**/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
where **Area Name Here** is either ControlPanel or Patients.
When I go to /patients/problems/create (for example), I get a 404 where the routing error says: A public action method 'create' was not found on controller 'MyApp.Areas.ControlPanel.Controllers.ProblemsController'.
I'm not sure what I'm doing wrong.