coure2011
coure2011

Reputation: 42464

multiple controllers in Areas and Main site

I have multiple controllers one in Areas

/Areas/Demo/Admin/AdminController

and other in main site

/Controller/Admin/AdminController

Now getting error

Multiple types were found that match the controller named 'Admin'.

How to resolve the issue? Better if I can change something in Areas/Demo as I have to use same Areas on multiple sites.

Upvotes: 3

Views: 244

Answers (1)

Lukáš Novotný
Lukáš Novotný

Reputation: 9052

Define namespace in your route. http://msdn.microsoft.com/en-us/library/dd492682.aspx

For example my area "Admin" is mapped like this:

context.MapRoute(
    "Admin_default",
    "Admin/{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = UrlParameter.Optional },
    new string[] { "MvcBase.Areas.Admin.Controllers" }
);

Upvotes: 3

Related Questions