本文介绍了Session.Abandon()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Session.Abandon(); Session["AnotherSession"] = null; Session["MyName"] = "SomeName"

有时,我们遇到以下情况:如果您调用Session.Abandon()方法注销,然后按浏览器后退按钮,它将带您到上一个访问的页面,并显示该会话对象之前保存的网页中的所有值.

Sometimes we come across the scenario that on log off if you call Session.Abandon() method and you press Browser back button it will take you to the previous visited page and will show all the value in the web page which session object holds earlier. How to solve this type of problems?

推荐答案

不确定,但是尝试一下,希望对您有所帮助. Im not sure,but try this,I hope it will help you. Session.Remove("AnotherSession");

插入

insted of

Session.Abandon(); Session["AnotherSession"] = null;

Session.Abandon()

这对我有用: This worked for me: Session.clear();//clear session Session.Abandon();//Abandon session Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1)); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore();

这个好技巧将为您提供帮助. 注销后浏览器后退按钮问题 [ ^ ] This good tip will help you. Browser back button issue after logout[^]