Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的项目中使用会话,我写了
Session.Clear(); Response.Redirect("Login.aspx");
在注销按钮下。我在所有页面的页面加载事件中检查 Session["user"]。如果它为空,我将用户发送到 Login.aspx。但是当我将页面写入 url 时,页面没有转到页面加载事件,但是我单击了注销按钮。
你有什么主意吗?
提前致谢
恰格恩
Session.Clear()只清除会话字典中的值。使用Session.Abandon().
Session.Clear()
Session.Abandon()
在 ASP.NET 中,何时应该使用 Session.Clear() 而不是 Session.Abandon()?
尝试Session.Abandon 方法