1

I have problem with generation of links I have an Area named "Administration", it also has a HomeController as a root, In the masterpage

<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("Admin", "Index", "Home", new {area = "Administration"})</li>

Also I inherited From Route, and the method GetVirtualPath accepts the parameter values which omits area key, and passes only controller and action.

Where did I go wrong?

4

3 回答 3

6

您使用了不正确的重载。您应该使用LinkExtensions.ActionLink Method (HtmlHelper, String, String, String, Object, Object)(注意最后一个参数)

@Html.ActionLink("Admin", "Index", "Home", new {area = "Administration"}, null)
于 2012-01-27T16:38:02.663 回答
1
<li>@Html.ActionLink("Home", "Index", "Home", new {area = ""}, null)</li>
<li>@Html.ActionLink("Admin", "Index", "Home", new {area = "Administration"}, null)</li>
于 2012-01-27T17:28:24.400 回答
-1

问题解决了,并且在 DataTokens 中。我只为区域定义区域,而不是为根中的控制器定义区域。现在它起作用了。谢谢!

于 2012-01-30T13:26:30.650 回答