I am trying to use the logoff function offered by default in Identity:
// POST: /Account/LogOff
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LogOff()
{
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
return RedirectToAction("Index", "Home");
But every time I try to call this function it returns this error:
Application Server Error '/'.
And says the requested URL was:
Requested URL: / Manage / LogOff
To call this Action I used the following method:
@if (User.Identity.IsAuthenticated) {<li>@Html.ActionLink("Sair", "LogOff", "AccountController", FormMethod.Post)</li> }
Instead of calling AccountController I have tried to use only Account as described in the comment of the // POST: / Account / LogOff function, but I did not succeed.
To make this work, should I call it another way? or write a different method to log off?