Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC Futures strongly typed RenderAction with Areas and duplicate Controller Names
    primarykey
    data
    text
    <p>I'm trying to use an Html.RenderAction in a strongly typed nature from the MVC Futures library</p> <p>I have a Navigation action on my primary HomeController (area = "") that I'm trying to call from my Site.Master</p> <pre><code>&lt;% Html.RenderAction&lt;HomeController&gt;(x=&gt;x.Navigation()); %&gt; </code></pre> <p>This worked great until I added another HomeController to my Admin portable area. Then I started to the following error:</p> <blockquote> <p>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.</p> <p>The request for 'Home' has found the following matching controllers: Areas.Admin.Controllers.HomeController Web.Controllers.HomeController</p> </blockquote> <p>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.</p> <pre><code>&lt;% Html.RenderAction("Navigation", "Home", new { area = "" }); %&gt; </code></pre> <p>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.</p> <pre><code>_routeCollection.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new[] { "Web.Controllers" }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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