Search code examples
asp.net-mvc-3asp.net-mvc-3-areas

ASP.NET MVC Areas Naviation


I have a MVC web application with a logout form like this:

    @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { area = "", id = "logoutForm" }))
    {
        @Html.AntiForgeryToken()
        <a href="javascript:document.getElementById('logoutForm').submit()" class="k-button" style="color: black;">Log off</a>
    }

The problem is that if I have navigated to one of the areas and I click the LogOut button the action does not work.

Does anyone know how to make the above code work with the default area?

Thanks Gerry


Solution

  • Got it:

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

    This works!!!!!