Multiple types were found that match the controller named 'Home'

New Area registration error solution in Asp.net MVC

This type of error occurred, when you create a new area, and there is another home controller with index action name, it says multiple type home controllers found.

Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('{controller}/{action}/{id}') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter.

The request for 'Home' has found the following matching controllers:

Here is the Solution: [Solved]

for example here my new Area name is "Trainers"

Step 1:
In [NewAreaName]AreaRegistration file, set thr right namespace as highlighted below

public class TrainersAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Trainers";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Trainers_default",
"Trainers/{controller}/{action}/{id}",
new { action = "index", id = UrlParameter.Optional },
new[] { "ApplicationName.Areas.Trainers.Controllers" });
    }
}

Step 2:
In application root RouteConfig, make sure you have set the default namespace as highlighted below

public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "ApplicationName.Controllers" } 
            );
        }
    }
 
New Area registration error solution in Asp.net MVC

Free Tutorials Online