我在尝试获取在我所在的区域中工作的路由时遇到问题。mvc4区域内的路由动作无法映射动作
我的地区叫做ABC,我在该地区有一个叫做Home的控制器。如果我浏览“http:// localhost:8000/abc”,我可以用Home/Index命中断点,但是当我尝试点击另一个称为“http:// localhost:8000/ABC/details”的细节时,我会得到一个404
我已经试过
context.MapRoute(
"details",
"ABC/Home/{action}/{id}",
new { action = "details", id = UrlParameter.Optional },
constraints: null,
namespaces: new[] { "WebApplication.Areas.ABC.Controllers" }
);
context.MapRoute(
"ABC_Home",
"ABC/{controller}/{action}/{id}",
new { controller = "home",action="Index", id = UrlParameter.Optional },
constraints: null,
namespaces: new[] { "WebApplication.Areas.ABC.Controllers" }
);
这样,如果我使用 “http://本地主机:8000/ABC /主页/详细信息” 我打的动作
context.MapRoute(
"details",
"Home/Home/{action}/{id}",
new {controller="home", action = "details", id = UrlParameter.Optional },
constraints: null,
namespaces: new[] { "WebApplication.Areas.ABC.Controllers" }
);
理想如果可能的话,我不想在网址中使用家庭。我究竟做错了什么?
任何帮助将会很棒!
谢谢dbaseman –