Question

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

Was it helpful?

Solution

Got it:

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

This works!!!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top