In MVC3, I have the following areas:
Then i route maps like this:
context.MapRoute(
"Sandbox_default",
"Sandbox/{controller}/{action}/{id}",
new { controller = "SandboxHome", action = "Index", id = UrlParameter.Optional }
and
context.MapRoute(
"Mobile_default",
"Mobile/{controller}/{action}/{id}",
new { controller = "MobileHome", action = "Index", id = UrlParameter.Optional }
);
The problem is this gives urls like:
http://localhost:58784/Mobile/MobileHome
and
http://localhost:58784/Sandbox/SandboxHome
But I want it like this:
http://localhost:58784/Mobile/Home
http://localhost:58784/Sandbox/Home
The problem is when I rename the SandboxHome-Controller to Home, and the MobileHome-Controller to Home, which would give the desired URLs, it won't compile, saying it has two classes for HomeController.
How can I have the same controller name in different areas ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…