Reputation: 4289
How can I use Html.BeginForm to link from within an area to an action and controller not in an area? I am using:
using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
When I click the button it is looking for the controller in the area but it is not there.
Appreciate any suggestion.
Upvotes: 0
Views: 1513
Reputation: 4289
Thanks on helpful comments, The solution is:
using (Html.BeginForm("LogOff", "Account", new { area = "" }, FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
Upvotes: 1
Reputation: 24395
Try explicitly providing null
or empty string ""
as the area
:
using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { area = null, id = "logoutForm", @class = "navbar-right" }))
Upvotes: 0