0

During the Application startup , using the login Id of the User , i am making a Database call and loading all of his accounts and setting them in the session as shown session.setAttribute("userinfo",userinfo);

and i am using this accounts information in the service layer to do a check before making a call to the Database

Now the problem is that if a User (who is having multiple accounts ) logs simulatunosly into a same browser , its creating same sessionid , as a result the session is having only the information of the last logged in user .

is there anyway i can solve this , may be the way i am storing data

please help

Nandkumar Tekale
  • 16,024
  • 8
  • 58
  • 85
Pawan
  • 31,545
  • 102
  • 256
  • 434
  • I think you just need to update existing session with new information. Some code on what you are doing may help in providing valid solution. – kosa Aug 30 '12 at 14:28
  • Wait, isnt it better to prevent simeltaneous logins from the same browser ?? – Anuj Kulkarni Aug 30 '12 at 22:03

2 Answers2

0

May not be the best solution but this will help to solve the problem.

What you could do would be to associate the userid with the sessionid and on every pageload / clicks, you will check if the sessionid matches the login user's userid. If it matches, disregard and run the page as usual else you can fetch the user info from the database and reassign the variables again.

Guo Hong Lim
  • 1,690
  • 3
  • 13
  • 20
0

You can use URL rewrite instead of cookies. The downside is that the session ID is exposed in the URL.

Community
  • 1
  • 1
vanje
  • 10,180
  • 2
  • 31
  • 47