結束。我也,測試它的每page_load
我有,像這樣:如何真正與我使用<code>Session</code>讓我<code>login</code>會議
if (Session["login"] != null)
{
LbLogado.Text = "";
LbLogado.Text += "Logado Com: " + Session["login"].ToString();
}
else
{
Response.Redirect("~/login.aspx");
}
我也有一個按鈕exit
,這是事件:
Session.Clear();
Response.Redirect("~/Login.aspx");
當我點擊退出按鈕,我我想要結束每個session
。
正在發生的事情是,當我退出,並單擊瀏覽器返回到先前網頁其返回正常頁面,但我想重定向到login.aspx
頁面,因爲沒有sessions
活躍。
我發現了一些文章像this。但這不是我的觀點。
[Session.Abandon()](http://msdn.microsoft.com/en-us/library/system.web .sessionstate.httpsessionstate.abandon.aspx) – 2013-03-05 13:03:40
你有沒有看着Session.Abandon - http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.abandon.aspx - 因爲你要結束每個會話 - 也背動作並不真的發出/得到,如果你打回並刷新你可能會得到預期的行爲 – kd7 2013-03-05 13:05:06