在mvc4中从主页调用Area的Action

时间:2014-03-25 21:20:10

标签: asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 razor asp.net-mvc-areas

我有一个项目,我的主站点中有索引页面。

我想调用位于“ABC”区域的控制器的动作

我在主站点和我的区域ABC都有控制器“帐户”。

从主站点页面我想调用Accountcontroller的动作索引,这是我的区域ABC。

我尝试的是

@Html.ActionLink("User Profile","Index", new{Area="ABC"})

这指向

http://localhost:50010/ABC/Home

我不想要

我也试过

@Html.ActionLink("User Profile","Index","Account", new{Area="ABC"})

这指向

http://localhost:50010?Length=7

我无法找到解决这个问题的方法。

1 个答案:

答案 0 :(得分:2)

Html.ActionLink("User Profile", "Index", "Account", new { Area = "ABC" }, new{})
相关问题