Thursday, November 19, 2015

Logoff MVC

We cannot call logout function directly from an anchor tag or javascript .Reason they are supposed to be [HttpPost] with [ValidateAntiForgeryToken]

http://localhost:54673/Account/logOFF

we can achieve this by removing  [httpPost] and [ValidateAntiForgeryToken]


This is the default controller
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LogOff()
{
    WebSecurity.Logout();

    return View("Index");
}
public ActionResult LogOff()
{
    WebSecurity.Logout();

    return View("Index");
}

No comments:

Post a Comment