Different controllers with the same name in two different areas results in a routing conflict
Posted
by HackedByChinese
on Stack Overflow
See other posts from Stack Overflow
or by HackedByChinese
Published on 2010-04-26T06:31:39Z
Indexed on
2010/04/26
15:33 UTC
Read the original article
Hit count: 478
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.
© Stack Overflow or respective owner