MVC Html.BeginForm using Areas

Mariko picture Mariko · Mar 12, 2011 · Viewed 32.9k times · Source

I'm using MVC areas and on a view that's in an area called "Test" I would like to have a form that posts to the following method:

area: Security
controller: AccountController
method: logon

How can I make this happen with Html.BeginForm? Can it be done?

Answer

mosesfetters picture mosesfetters · Oct 27, 2012

For those of you that want to know how to get it to work with the default mvc4 template

@using (Html.BeginForm("LogOff", "Account", new { area = ""}, FormMethod.Post, new { id = "logoutForm" }))