为什么即使在所有销毁代码之后,session变量的值仍然保留? [英] Why does the value of session variable remain even after all the code of destruction?
本文介绍了为什么即使在所有销毁代码之后,session变量的值仍然保留?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if (IsPostBack == false)
{
//destroy any login information
Session["password"] = "false";
Session["login"] = "false";
Session.Abandon();
Session.RemoveAll();
}
if (TextBox2.Text == main_password)
{//then he is website server admin
Session["password"] = "password";
Session["login"] = "true";
Response.Redirect("~/TABLE.aspx");
}
table.aspx
//checking if website server admin
if ("password" == (string)Session["password"])
{
link_logout.Enabled = true;
}//if ends
else
{//not authorized
Response.Redirect("~/Identify.aspx");
}//else ends
当我单击注销链接时
- 登录页面被加载,导致所有会话状态被破坏.
- 登录页面确认我使用
response.write
查看会话变量的值. - 输入用户名和密码并单击登录"时,它将重定向到表格页面.
- 当我单击注销时,它会重定向到登录页面,并且登录页面会破坏信息.
- the login page gets loaded, causing destruction of all the session states.
- the login page confirms to that when I use
response.write
to view the values of the session variables. - when I give user name and password and click login, it redirects to table page.
- when I click logout, it redirects to login page and login page destroys info.
- 登录信息被破坏后,我单击表格链接,它会转到表格页面,如"NO NO"(否),然后重定向到登录页面.
- 但是,如果我复制粘贴表格页面的网址,那么无论我做什么,它都允许我查看该页面.也就是说,即使会话值被销毁,它也会获取会话变量的值并评估为TRUE.
我无法使用asp.net登录功能,我的限制不允许我使用该控件.
I can't use asp.net login functions, my limitations do not allow me to use that control.
推荐答案
您正在浏览器中看到页面的缓存版本.
You're seeing a cached version of the page in the browser.
如果按Ctrl + F5,它将消失.
If you press Ctrl+F5, it should go away.
这篇关于为什么即使在所有销毁代码之后,session变量的值仍然保留?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文