Multiple controllers in zones and on the main site

I have several controllers one in the area

/Areas/Demo/Admin/AdminController

and others on the main site

/Controller/Admin/AdminController

Now we get the error

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

How to solve the problem? It’s better if I can change something in the / Demo area, since I have to use the same areas on multiple sites.

+3
source share
1 answer

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

For example, my "admin" area is displayed as follows:

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

Source: https://habr.com/ru/post/1795707/


All Articles