在MVC3中,我有以下几个方面:
- 移动
- 砂箱
然后我像这样路由地图:
context.MapRoute(
"Sandbox_default",
"Sandbox/{controller}/{action}/{id}",
new { controller = "SandboxHome", action = "Index", id = UrlParameter.Optional }
Run Code Online (Sandbox Code Playgroud)
和
context.MapRoute(
"Mobile_default",
"Mobile/{controller}/{action}/{id}",
new { controller = "MobileHome", action = "Index", id = UrlParameter.Optional }
);
Run Code Online (Sandbox Code Playgroud)
问题是这给网址如下:
和
但我希望这样:
http:// localhost:58784/Mobile/Home
http:// localhost:58784/Sandbox/Home
问题是当我将SandboxHome-Controller重命名为Home,而MobileHome-Controller重命名为Home时,它将提供所需的URL,它将无法编译,说它有两个类用于HomeController.
如何在不同区域使用相同的控制器名称?