How to differentiate between logout and session expired?

后端 未结 3 955
温柔的废话
温柔的废话 2020-12-08 17:45

Case 1: Log out : Once we log out, if one tries to access previous, it must automatically redirect to login.jsp

Case 2: Session expired : If session expires when use

3条回答
  •  春和景丽
    2020-12-08 18:43

    On login, set a cookie with a long expiry (> 24 hours). Remove this cookie at logout time by setting the maxage to 0.

    You can have check for any non-logged in user (i.e. invalid session id). If the cookie does not exist, redirect him to login.jsp

    If the cookie exists, it means his session expired so redirect him to session-expired.jsp

提交回复
热议问题