我在我的项目中使用 session ,我写了
Session.Clear();
Response.Redirect("Login.aspx");
在注销按钮下。我正在检查所有页面的页面加载事件中的 Session["user"]。如果它为空,我将用户发送到 Login.aspx。但是,当我将页面写入 url 时,页面没有转到页面加载事件,但是我单击了注销按钮。
你有什么想法吗?
提前致谢
恰安
最佳答案
Session.Clear()
只清除 session 字典中的值。使用 Session.Abandon()
。
In ASP.NET, when should I use Session.Clear() rather than Session.Abandon()?
关于c# - session 已终止但页面即将到来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3987434/