When I'm deleting a user I want it to automatically log out, but whenever I call the logout-function using RedirectToAction, I get a 404. I saw somewhere else on stackoverflow, that this was tried to be achieved through a button-click and the methods being [HttpPost] and [HttpGet] was conflicting - but that is seemingly not the case here.
Usercontroller
[HttpPost]
public ActionResult DeleteConfirmed(int id)
{
User user = db.Users.Find(id);
db.Users.Remove(user);
db.SaveChanges();
return RedirectToAction("LogOff", "Account");
}
Accountcontroller
[HttpPost]
public ActionResult LogOff()
{
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
return RedirectToAction("Index", "Home");
}
Anyone having an idea why that is? URL looks right.