为什么即使在所有销毁代码之后,session变量的值仍然保留?

编程入门 行业动态 更新时间:2024-10-23 21:27:32
本文介绍了为什么即使在所有销毁代码之后,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登录功能,我的限制不允许我使用该控件.

I can't use asp 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变量的值仍然保留?

本文发布于:2023-10-14 12:00:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1491002.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   代码   session

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!