I have an MVC application with different user accounts and passwords. The log in feature works fine, but when I click the log out button I get a 404 error saying:
Server Error in '/' Application.
The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had >its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled >correctly.
Requested URL: /Account/LogOff
This is the code for the log out button:
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Log Off", "LogOff", "Account")</li>
</ul>
</div>
This is the code in the AccountController
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LogOff()
{
Session.Clear();
FormsAuthentication.SignOut();
return RedirectToAction("Index", "Home");
}