代码
/Areas/Test/TestAreaRegistration.cs
context.MapRoute(
"Test_default",
"Test/{controller}/{action}/{id}/",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "Web.Areas.Test.Controllers"}
);
//Global.asax
routes.MapRoute(
"Home", // Route name
"{controller}/{action}/{id}/", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "Web.Controllers"}
);
"Home", // Route name
"{controller}/{action}/{id}/", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "Web.Controllers"}
);
在ASP.NET MVC中,当Controller在主区域和Areas下面同名时,可能会引发冲突。本文介绍如何通过调整配置和命名策略来解决这个问题。

被折叠的 条评论
为什么被折叠?



