firefox浏览器的注销问题 [英] Logout issue for firefox browser

查看:942
本文介绍了firefox浏览器的注销问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





这是我的代码



Hi,

this is my code

Session.Abandon();
Session.Clear();
Response.Expires = 1;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);// Now(-1);
Response.AddHeader("pragma",
"no-cache");
Response.AddHeader("cache-control",
"private");
Response.CacheControl = "no-cache";
Request.Cookies.Clear();
Response.Cookies.Clear();
FormsAuthentication.SignOut();
Session["User"]=null;
if (Session["User"] == null)
{
    return View();
}



它在crome上工作。但是在注销后firefox中还重定向到前一页,

表示窗口历史记录没有删除,即使我使用window.history.forward()也是同样的问题。



如何解决它?


its working on crome.But in firefox after logout also redirecting to previous pages,
means window history is not deleting, even if i used window.history.forward() also same issue.

how can i resolve it?

推荐答案

看看 Sandeep Mewara 的优秀提示 - 注销后的浏览器后退按钮问题 [ ^ ]
Take a look at the Excellent Tip by Sandeep Mewara- Browser back button issue after logout[^]


您可以将以下代码放在get action上,



You can put following code on get action ,

Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
               Response.Cache.SetValidUntilExpires(false);
               Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
               Response.Cache.SetCacheability(HttpCacheability.NoCache);
               Response.Cache.SetNoStore();
               ViewBag.Message = null;
               if (Session == null)
               {

                   return RedirectToAction("Index", "Login");

               }
               else
               {
                   if (Session.Count == 0)
                   {
                       return RedirectToAction("Index", "Login");
                   }
               }
           }


这篇关于firefox浏览器的注销问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆