|登录 |注册

查看: 2240|回复: 10
打印 上一主题 下一主题

[疑问]Logout的逻辑问题

 关闭 [复制链接]
duo8668
2009-10-17 08:29 PM
想请问各位大大,我的web apps 在 logout 的时候按 Back 时为什么能够看回之前的privacy data呢? 要怎么才能弄得像 Facebook 那样 logout 了就一定 要 login 过才能看回之前本身的资料?本身对 cookies 和 session 有稍微试过, meta header 也disable cache过,就是不行。。。

谢谢!

ASP/PHP/JSP 什么都行。。。
Super-Tomato
2009-10-17 09:16 PM
原帖由 duo8668 于 2009-10-17 08:29 PM 发表
想请问各位大大,我的web apps 在 logout 的时候按 Back 时为什么能够看回之前的privacy data呢? 要怎么才能弄得像 Facebook 那样 logout 了就一定 要 login 过才能看回之前本身的资料?本身对 cookies 和 ses ...


cookies 或 session 在退出的時候沒有刪除才會這樣

回复 #1 duo8668 的帖子

宅男-兜着走
2009-10-17 09:17 PM
destroy 掉 session 不行吗??

回复 #1 duo8668 的帖子

宅男-兜着走
2009-10-17 09:19 PM
顺便, set 个 function 就是, watch session的, 没fill 到的话就跳页。 通常就可以了。 我记得我老师说过, destroy 了就要从新 fill 过 session 才可以看到。
duo8668
2009-10-17 09:57 PM
原帖由 Super-Tomato 于 2009-10-17 09:16 PM 发表


cookies 或 session 在退出的時候沒有刪除才會這樣

cookies应该是不能删除的对吗?
我在 jsp 内 invalidate session了。。。按 Back 还是能看见 privacy data。
过后去 asp set cookies date(-1) 也是。。。不行。。。
最后跑去弄 meta disable cache 。。。 结果还是一样。。。

想破脑袋了
duo8668
2009-10-17 10:00 PM
原帖由 宅男-兜着走 于 2009-10-17 09:19 PM 发表
顺便, set 个 function 就是, watch session的, 没fill 到的话就跳页。 通常就可以了。 我记得我老师说过, destroy 了就要从新 fill 过 session 才可以看到。

destroy session 是不是 invalidate session 的?
我每页都有check session/cookies。。。结果不行。

各位大大有没有试过这种情形呢?
Super-Tomato
2009-10-17 10:14 PM
原帖由 duo8668 于 2009-10-17 10:00 PM 发表

destroy session 是不是 invalidate session 的?
我每页都有check session/cookies。。。结果不行。

各位大大有没有试过这种情形呢?


把你 login 和 logout 部分的 code 貼出來吧
duo8668
2009-10-17 10:40 PM
  1.     protected void processRequest(HttpServletRequest request, HttpServletResponse response)
  2.     throws ServletException, IOException {
  3.         response.setContentType("text/html;charset=UTF-8");
  4.         PrintWriter out = response.getWriter();
  5.         try {
  6.             HttpSession session=request.getSession();
  7.             session.invalidate();
  8.             response.sendRedirect("index.jsp");
  9.         } finally {
  10.             out.close();
  11.         }
  12.     }
复制代码
  1.             session = request.getSession(false);
  2.             String validUser = (String) session.getAttribute("validUser");
  3.             //PackagePurchased pp =(PackagePurchased)session.getAttribute("purchase");
  4.             // Details
  5.             String packageID = null;
  6.             String description = null;
  7.             String startDate = null;
  8.             String endDate = null;
  9.             String destination = null;
  10.             double cost = 0;
  11.             String quantity = null;
  12.             String date = null;
  13.             double totalCost = 0;
  14.             Vector v = new Vector();
  15.             PackagePurchased pp;
  16.             int LoginID = 0;
  17.             String LoginName = null;
  18.             if (validUser == null || validUser.equals("NO")) {
  19.                 response.sendRedirect("login.jsp");
  20.             } else {
  21.                 v = (Vector) session.getAttribute("history");
  22.             }
复制代码


谢谢!
Super-Tomato
2009-10-17 11:04 PM
原帖由 duo8668 于 2009-10-17 10:40 PM 发表
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8") ...


HttpSession.Invalidate();//自己看看 Sun 网站說明
request.getSession(false) //如果不存在则为 null 值
goodday
2009-10-18 12:47 AM
protected override void Page_Load(object sender, EventArgs e)
    {
        // clear cache
        Response.CacheControl = "no-cache";
        Response.Expires = -1;
        Response.AddHeader("Pragma", "no-cache");

.net 的 意思是 这个网页不要过cache
所有的网页都会存在browse 的cache (temporary internet files)
上面的是存在 ram 里不是在 hdd 理
您需要登录后才可以回帖 登录 | 注册

JBTALKS.CC |联系我们 |隐私政策 |Share

GMT+8, 2025-4-21 09:05 PM , Processed in 0.099655 second(s), 26 queries .

Powered by Discuz! X2.5 © 2001-2012 Comsenz Inc.

本论坛言论纯属发表者个人意见,与本论坛立场无关
Copyright © 2003-2012 JBTALKS.CC All Rights Reserved

Dedicated Server powered by iCore Technology Sdn. Bhd.

合作联盟网站:
JBTALKS 马来西亚中文论坛 | JBTALKS我的空间 | ICORE TECHNOLOGY SDN. BHD.
回顶部