Issue with Controllers that have the same name when using Areas

Aug 2, 2010 at 4:52 PM
Edited Aug 2, 2010 at 10:55 PM

Hi, i have an Admin area with a controller in it called HomeController. This seems to conflict with the HomeController in the route of the site with the following site map:

<mvcSiteMap xmlns="" enableLocalization="true">
  <mvcSiteMapNode title="Home" controller="Home" action="Index" changeFrequency="Always" updatePriority="Normal">
    <mvcSiteMapNode title="Admin" area="Admin" controller="Home" action="Index" />

This throws back the error "Ambiguous controller. Found multiple controller types for HomeController." when trying to display the SiteMapTitle. This worked fine before adding the site map stuff as i change the default rule in the Global.asax file to the following:

routes.MapRoute( "Default", // Route name
                 "{controller}/{action}/{id}", // URL with parameters
                 new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
                 new string[] { "MyApplication.Controllers" } // Default namespace );

I'd appreciate it if someone could help. Thanks

Aug 3, 2010 at 11:02 AM

Have you tried using the latest source code? (Source code tab above, download the latest code base and check for the 2.1.0 branch...)

Aug 4, 2010 at 9:19 AM
Edited Aug 4, 2010 at 9:20 AM

Hi yeah i've just tested that branch too and the problem still remains. I've uploaded a sample application so you can switch out the library with your latest builds to test. You can download it here

I'd appreciate if you could help as i'm on abit of a tight schedule and am considering rolling out my own provider.  Thanks

Aug 4, 2010 at 10:47 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Aug 4, 2010 at 10:48 AM

Can you try that branch again? Code has been updated.

Aug 5, 2010 at 9:04 AM

Hi, i tried the 2.1.0 branch and problem still remains.

Aug 5, 2010 at 9:58 AM

And the 2.2.0 branch?

Aug 5, 2010 at 6:36 PM
Edited Sep 2, 2010 at 8:45 AM

Definitely getting closer, if you try my sample project i have uploaded (but replace the SiteMapProvider reference with the one from the 2.2.0 branch) the Admin home page now displays correctly.  However when you click to view the details of a user you get the same error complaining about ambiguous controller names.  Thanks for your help so far, i think this is the final hurdle.

Here's some information about the error:

"Multiple types were found that match the controller named 'Home'..." - AuthorizeAttributeAclModule.cs (line 87):

This is the code that throws the error:

controller = ControllerBuilder.Current.GetControllerFactory().CreateController(requestContext, mvcNode.Controller) as ControllerBase;

Aug 13, 2010 at 3:41 PM

Ok will have a look at it.

Aug 28, 2010 at 12:47 PM

Hi, i've just tested change set 50773 and i can't even open the home page now.  It just throws the error above.  Really appreciate it if you could help.