Jim
Jim

Reputation: 16022

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.IsAuthenticated) {
    <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 = "" }) ]
}

Upvotes: 2

Views: 3565

Answers (1)

Jim
Jim

Reputation: 16022

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 {})

Upvotes: 4

Related Questions