如何从客户端调用Logoff操作我写了这段代码但是 它给我一个错误404
这是代码
location.href = '@Url.Action("LogOff", "Account")';
答案 0 :(得分:0)
只需将HttpPost
方法更改为HttpGet
中的AccountController
方法,或根据需要实施两者
[HttpGet]
public ActionResult LogOff()
{
WebSecurity.Logout();
Session.Clear();
return RedirectToAction("Index", "Home");
}
[HttpPost]
public ActionResult LogOff(FormCollection c)
{
WebSecurity.Logout();
Session.Clear();
return RedirectToAction("Index", "Home");
}