我有一个控制器上Logout action
像这样:ASP.NET MVC注销与窗体身份验证
public ActionResult Logout()
{
FormsAuthentication.SignOut();
Session["UserCredential"] = null;
return RedirectToAction("Index", "Home");
}
该工作在谷歌Chrome浏览器。但是当我在第一次登录和注销后使用我的web应用程序和firefox浏览器(最新版本)时。当我再次登录到应用程序并按下注销按钮时,我无法从Web应用程序注销。 Request.IsAuthenticated
正在给我真正的价值。
对于登录我用以下行动:
[HttpPost]
public JsonResult Login(string userName, string password)
{
User oUser = oRepository.GetUser(userName,password);
Session["UserCredential"] = oUser;
if (oUser != null)
{
if (oUser.IsVerified)
{
string url = Request.Url.AbsolutePath;
FormsAuthentication.SetAuthCookie(userName, false);
return Json(new { res = 1, RedirectUrl = Url.Action("Index", "Home") }, JsonRequestBehavior.AllowGet);
}
else
{
return Json(new { res = 0, RedirectUrl = "" }, JsonRequestBehavior.AllowGet);
}
}
return Json(new { res = -1, RedirectUrl = "" }, JsonRequestBehavior.AllowGet);
}
任何人有知道我必须做的解决我用firefox浏览器的问题。
浏览器控制台中的任何错误? –
没有。实际上在注销按钮按它调用主控制器的索引操作。 –
然后你解决了你的问题 –