Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple types were found that match the controller named 'Home' - In two different Areas
    primarykey
    data
    text
    <p>I have two areas in my project. Now when I run the program I get this error: </p> <pre><code>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: BaseAdminMVC.Areas.BaseAdmin.Controllers.HomeController BaseAdminMVC.Areas.TitomsAdmin.Controllers.HomeController </code></pre> <p>I have found some source here: <a href="https://stackoverflow.com/questions/5092589/having-issue-with-multiple-controllers-of-the-same-name-in-my-project">Multiple Controller name</a><br> But I think it only works for one area.<br> In my case I have two projects in different areas. Hope someone could tell what should I do to solve the problem.<br> Here is the <code>Global.asax</code> file: </p> <pre><code>public static void RegisterRoutes(RouteCollection routes) { string[] namespaces = new string[] { "BaseAdminMVC.Areas.BaseAdmin.Controllers", "BaseAdminMVC.Areas.TitomsAdmin.Controllers"}; routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces ); } </code></pre> <p>By the way, I have also controller ("<code>HomeController</code>") outside the <code>Area</code> folder. This just provides links to two projects <code>BaseAdmin</code> and <code>TitomsAdmin</code>.</p> <p>I have tried this solution, but still <strong>doesn't work</strong>: </p> <pre><code>routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); routes.MapRoute( "BaseAdmin", "BaseAdmin/{controller}/{action}", new { controller = "Account", action = "Index" }, new string[] { "BaseAdminMVC.Areas.BaseAdmin.Controllers" } ); routes.MapRoute( "TitomsAdmin", "TitomsAdmin/{controller}/{action}", new { controller = "Home", action = "Index" }, new string[] { "BaseAdminMVC.Areas.TitomsAdmin.Controllers" } ); </code></pre> <p>Thanks in advance!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload