I'm trying to use an Html.RenderAction in a strongly typed nature from the MVC Futures library
I have a Navigation action on my primary HomeController (area = "") that I'm trying to call from my Site.Master
<% Html.RenderAction<HomeController>(x=>x.Navigation()); %>
This worked great until I added another HomeController to my Admin portable area. Then I started to the following error:
Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request 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: Areas.Admin.Controllers.HomeController Web.Controllers.HomeController
I was able to resolve the issue by using the following non-mvccontrib strongly typed RenderAction method. I would rather not have this non-strongly typed method on the page, is there a way to make the mvccontrib methods accept an area, or for them to know to generate the area based on routes or the namespace of the Controller being specified.
<% Html.RenderAction("Navigation", "Home", new { area = "" }); %>
I have already added to my global.asax.cs file to support the multiple controllers with a default area as shown below, and I've also verified that this is the correct namespace for my controllers.
_routeCollection.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new[] { "Web.Controllers" });