"Find multiple types that match the Controller named" home. If the namespace is not specified for the routing service provided by this request ("{controller}/{action}/{ID}") when the Controller that matches this request is searched, this happens. If so, register the route by calling the overload of the "maproute" method containing the "namespaces" parameter ."
This problem occurs because the default route entry has been registered in the default golbal. asax. CS file.
Public static void registerroutes (routecollection routes)
{
Routes. ignoreroute ("{resource}. axd/{* pathinfo }");
Routes. maproute (
"Default", // route name
"{Controller}/{action}/{ID}", // URL with Parameters
New {controller = "home", Action = "Index", id = urlparameter. optional}, // parameter defaults
// New String [] {"working_with_areas.controllers "}
);
}
In areas, a controller with the same name is registered.
Public override void registerarea (arearegistrationcontext context)
{
Context. maproute (
"Admin_default ",
"Admin/{controller}/{action}/{ID }",
New {Action = "Index", id = urlparameter. optional },
// New String [] {"working_with_areas.areas.admin.controllers "}
);
}
The solution is to add a namespace when registering a router.