java - After session timeout redirect to last visited page for previous user -


when session timeout, redirect login page. need that, whether login user name same user name, logged in before session timeout, page redirect previous user visited page login page.

for example,

        user name admin, when user open contactus.jsp, after session timeout page redirect login.jsp, in login.jsp whether same admin user logged in then, page redirect contactus.jsp instead of home.jsp. 

thanks in advance.

one way of achieving using cookies.

but best way below one.

if using db in application can in below way:

  1. create table in db fields ip address, user name, last visited page.

  2. when user performs login, insert values table.

  3. when user performs logout or when session time out occurs, update table , set last visited page current jsp name.

  4. again @ login, before inserting row in table, make check on ip address. if row present current ip address , if user names match, retrieve last visited page value table , forward user jsp page.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -