鏈接到一個區域:
@Url.Action("Index","Home", new { area = "YourAreaName" })
鏈接到一個地方的任何區域:
@Url.Action("Index","Home", new { area = "" })
一個有用的清單:
@Html.ActionLink("LinkText", "ActionName", new { area = "AreaName" })
@Html.ActionLink("LinkText", "ActionName", new { area = "" })
@Html.ActionLink("LinkText", "ActionName", "ControllerName", new { area = "AreaName" }, new { /* html attributes */ })
@Html.ActionLink("LinkText", "ActionName", "ControllerName", new { area = "" }, new { /* html attributes */ })
<a href="@Url.Action("ActionName", new { area = "AreaName" })">Link Text</a>
<a href="@Url.Action("ActionName", new { area = "" })">Link Text</a>
<a href="@Url.Action("ActionName", "ControllerName", new { area = "AreaName" })">Link Text</a>
<a href="@Url.Action("ActionName", "ControllerName", new { area = "" })">Link Text</a>
簡單快速的回答,傷心我沒有想到這個我自己,讚賞。 – Valchris