title: @Html.Action and Controllers with same name
body: <p>While creating a Plugin for a MVC site, I'm facing an issue about controller resolution.</p>
  
  <p>Here are all the routes that concern the current context :</p>
  
  <pre><code>routes.MapRoute("Route1",
      "Admin/Product/{action}/{id}",
      new { controller = "Product", action = "Index", area = "Admin", id = UrlParameter.Optional },
      new[] { "Plugin.Controllers" }
  )
  
  routes.MapRoute(
      "Admin_default",
      "Admin/{controller}/{action}/{id}",
      new { controller = "Home", action = "Index", area = "Admin", id = "" },
      new[] { "Admin.Controllers" }
  );
  
  routes.MapRoute(
      "Default", // Route name
      "{controller}/{action}/{id}", // URL with parameters
      new { controller = "Home", action = "Index", id = UrlParameter.Optional },
      new[] { "Public.Controllers" }
  );
  </code></pre>
  
  <p>There are 3 ProductController classes in the entire solution :</p>
  
  <ul>
  <li>Plugin.Controllers.ProductController (inherits from the Admin one)</li>
  <li>Admin.Controllers.ProductController</li>
  <li>Public.Controllers.ProductController</li>
  </ul>
  
  <p>In my view "/Views/Home/Index.cshtml" (i.e. the "Index" action of the HomeController without any area) I have the following code :</p>
  
  <pre><code>@Html.Action("HomepageProducts", "Product")
  </code></pre>
  
  <p>It refers to the action "HomepageProducts" of the <strong>Public.Controllers</strong>.ProductController.</p>
  
  <p>MVC looks for the plugin controller instead of the public one and throws the following exception :</p>
  
  <blockquote>
    <p>[HttpException (0x80004005): A public action method 'HomepageProducts' was not found on controller '<strong>Plugin.Controllers.ProductController</strong>'.]
       System.Web.Mvc.Controller.HandleUnknownAction(String actionName) +291
       System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +31
       System.Web.Mvc.Async.WrappedAsyncVoid<code>1.CallEndDelegate(IAsyncResult asyncResult) +29
       System.Web.Mvc.Async.WrappedAsyncResultBase</code>1.End() +49
       System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
       System.Web.Mvc.Controller.b__15(IAsyncResult asyncResult, Controller controller) +12
       System.Web.Mvc.Async.WrappedAsyncVoid<code>1.CallEndDelegate(IAsyncResult asyncResult) +22
       System.Web.Mvc.Async.WrappedAsyncResultBase</code>1.End() +49
       System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
       System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
       System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
       System.Web.Mvc.Async.WrappedAsyncVoid<code>1.CallEndDelegate(IAsyncResult asyncResult) +29
       System.Web.Mvc.Async.WrappedAsyncResultBase</code>1.End() +49
       System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
       System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
       System.Web.Mvc.&lt;>c__DisplayClassa.b__9() +22
       System.Web.Mvc.&lt;>c__DisplayClass4.b__3() +10
       System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +27</p>
    
    <p>[HttpException (0x80004005): Execution of the child request failed. Please examine the InnerException for more information.]
       System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +102
       System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Action action) +64
       System.Web.Mvc.ServerExecuteHttpHandlerAsyncWrapper.EndProcessRequest(IAsyncResult result) +71
       System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +1436</p>
    
    <p>[HttpException (0x80004005): Erreur d'exécution de la demande enfant pour le gestionnaire 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.]
       System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +3428452
       System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +76
       System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +29
       System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +24
       System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +464
       System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +83
       System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName) +10
       ASP._Page_Views_Home_Index_cshtml.Execute() in c:\Path\To\My\Project\Views\Home\Index.cshtml:14</p>
  </blockquote>
  
  <p>If this helps, the solution use Autofac.MVC5...
  Any help/comment/idea is welcome.</p>
  
  <p>Am I missing something or only the routes are implied in controllers resolution ?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>When browsing the "Admin" area all actions are well performed, the plugin and the admin controllers works fine. </p>
  
  <p>If I comment the plugin route, the error is not thrown anymore. Of course my plugin controller is not called anymore. </p>
  
  <pre><code>// routes.MapRoute("Route1",
  //     "Admin/Product/{action}/{id}",
  //     new { controller = "Product", action = "Index", area = "Admin", id = UrlParameter.Optional },
  //     new[] { "Plugin.Controllers" }
  // )
  </code></pre>
  
  <p>So I guess the issue is due to the plugin route, the plugin controller itself or the way the route is resolved by MVC ?</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>I tried to uncomment all my routes and specify area in @Html.Action() as follow:</p>
  
  <pre><code>@Html.Action("HomepageProducts", "Product", new { area = "" })
  </code></pre>
  
  <p>But MVC ignore the area and try to load the Plugin controller...</p>
  
  <blockquote>
    <p>[HttpException (0x80004005): A public action method 'HomepageProducts' was not found on controller '<strong>Plugin.Controllers</strong>.ProductController'.]</p>
  </blockquote>