__Setup__:
My application has only attribute routing enabled.
__Controllers__:
Through the below controllers, I am simulating a user scenario where the user has a controller called HomeController in the root of the application and also in an area called "Administration". This scenario seems to be common among users.
```
using System.Web.Mvc;
namespace RuntimeWebApp
{
namespace Areas.Administration.Controllers
{
[RouteArea("Administration", AreaPrefix = "Admin")]
[Route("Home/{action}")]
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("Admin.Home.Index");
}
}
}
namespace Controllers
{
[Route("Home/{action}")]
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("Home.Index");
}
}
}
}
```
__Requests__:
GET /Admin/Home/Index -> Succeeds and prints 'Admin.Home.Index'
GET /Home/Index -> __Fails__ with 500 Internal Server Error and the following error detail:
__Exception__:
```
Server Error in '/RuntimeWebApp' Application.
Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('Home/{action}') 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:
RuntimeWebApp.Areas.Administration.Controllers.HomeController
RuntimeWebApp.Controllers.HomeController
```
__Route table__ looks like below for the above attributed controllers:
```
config.Routes.MapRoute("routeName", "Admin/Home/{action}", new { controller = "Home" }, new { }, new { MS_DirectControllerRoute = "System.Web.Mvc.Async.ReflectedAsyncControllerDescriptor", area = "Administration", UseNamespaceFallback = "False", Namespaces = "RuntimeWebApp.Areas.Administration.Controllers" });
config.Routes.MapRoute("routeName", "Home/{action}", new { controller = "Home" }, new { }, new { MS_DirectControllerRoute = "System.Web.Mvc.Async.ReflectedAsyncControllerDescriptor" });
```
__Expected__: Have namespace information even for the non-Area based controllers too to avoid this ambiguous error
Comments: Verified.
My application has only attribute routing enabled.
__Controllers__:
Through the below controllers, I am simulating a user scenario where the user has a controller called HomeController in the root of the application and also in an area called "Administration". This scenario seems to be common among users.
```
using System.Web.Mvc;
namespace RuntimeWebApp
{
namespace Areas.Administration.Controllers
{
[RouteArea("Administration", AreaPrefix = "Admin")]
[Route("Home/{action}")]
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("Admin.Home.Index");
}
}
}
namespace Controllers
{
[Route("Home/{action}")]
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("Home.Index");
}
}
}
}
```
__Requests__:
GET /Admin/Home/Index -> Succeeds and prints 'Admin.Home.Index'
GET /Home/Index -> __Fails__ with 500 Internal Server Error and the following error detail:
__Exception__:
```
Server Error in '/RuntimeWebApp' Application.
Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('Home/{action}') 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:
RuntimeWebApp.Areas.Administration.Controllers.HomeController
RuntimeWebApp.Controllers.HomeController
```
__Route table__ looks like below for the above attributed controllers:
```
config.Routes.MapRoute("routeName", "Admin/Home/{action}", new { controller = "Home" }, new { }, new { MS_DirectControllerRoute = "System.Web.Mvc.Async.ReflectedAsyncControllerDescriptor", area = "Administration", UseNamespaceFallback = "False", Namespaces = "RuntimeWebApp.Areas.Administration.Controllers" });
config.Routes.MapRoute("routeName", "Home/{action}", new { controller = "Home" }, new { }, new { MS_DirectControllerRoute = "System.Web.Mvc.Async.ReflectedAsyncControllerDescriptor" });
```
__Expected__: Have namespace information even for the non-Area based controllers too to avoid this ambiguous error
Comments: Verified.