Route Values for Area (MVC3)
I am using areas in MVC version 3. My logoff and logon action methods are routing to the area, and I need them to route to the normal controller that is not in an area.
I have tried the following
host://AREA/CONTROLLER/METHOD instead of host://CONTROLLER/METHOD.
@if(Request.IsAuthenticat开发者_运维百科ed) {
<text>Welcome <b>@Context.User.Identity.Name</b>
[ @Html.ActionLink("Log Off", "LogOff", "Account", new { area = "" }) ]</text>
}
else {
@:[ @Html.ActionLink("Log On", "LogOn", "Account", new { area = "" }) ]
}
I have figured this out. Apparently I need the additional parameter, it's being applied to the wrong overload.
@Html.ActionLink("Log Off", "LogOff", "Account", new { area = string.Empty }, new {})
精彩评论