?
Solved

one site ,open two browser with two accounts ,interchanging the data ,how to avoid this?

Posted on 2003-03-26
15
Medium Priority
?
187 Views
Last Modified: 2010-03-31
Hi,
I've a problem with my https site,if two users opened in the two different browser windows in the same machine the second entered data got over ridden with older one,i am setting a secure cookie in my servlet because i 've to have cookie,how we can avoid the second user will not get the first users data?Right now i put a check in the Login servlet to check whether it has any cookie ,force the user to close the browser and open a new one,the need is we want both the users will be alive with their data.
if you need more info please let me know.
Thx
sethu
0
Comment
Question by:sethupathi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +5
15 Comments
 

Author Comment

by:sethupathi
ID: 8213033
This is some what difficult situation so its really appreciated if i get answer.
0
 
LVL 3

Expert Comment

by:wide_awake
ID: 8213226
How can two different users open two different browsers on the same machine at the same time?

Maybe I don't understand your question properly...
0
 

Author Comment

by:sethupathi
ID: 8213307
ok. one user has two accounts with my site ,he opened one window with his first username,open the second window and log in with second username ,now if goes back to first window and try to go some other link he is getting the second user name's information ,the cookie which was set to the first one was over ridden with second one,the question is how we can keep the same cookie for each user?here i am setting only tmp cookie once the browser closed the cookie will be gone,now you go thru the first mail probably will give you good understanding.
if you need some more let me know
Thanks for immeadiate response, i've a hope once i was got back by you.
Thanks
sethu
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:girionis
ID: 8213312
> How can two different users open two different browsers on the same machine at the same time?

  Exactly!!!
0
 
LVL 35

Expert Comment

by:girionis
ID: 8213323
 How are you setting the cookies? Does each cookie contains unique information or do you have the same information in both cookies?
0
 
LVL 1

Expert Comment

by:igor_sk
ID: 8213345
There is only one instance of servlet class regardless of number of connected users.

When your firts user connect you, probably, store some of his data in Login servlet object data. When second user connects, the same Login servlet object instance is used. Therefore, the second user will see first user's data.

If you need to store some user's data for future use you can store it in corresponding HttpSession object:

session.setAttribute(java.lang.String name,
                     java.lang.Object value)

You can use session.getAttribute(java.lang.String name) method to get this data later.
0
 
LVL 3

Expert Comment

by:wide_awake
ID: 8213730
Can you (a) set the cookie filename?  Or (b) the location of the cookie file?  If either of those are possible, you can do (a) set the cookie to be username.txt, or (b) <cookiePath>/username/cookie.txt

-Mark.
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 8214224
You need to login the different users from different browser processes, and not two browser windows from the same process. All windows for the one process  (in IE, NS at least) share the same cookies, and thus the same session if you are using cokkies for session management.

If you use URL rewriting on the other hand for maintaining session then each window will have it's own session.
0
 
LVL 1

Expert Comment

by:Jitu
ID: 8215852
Since you are setting the cookies yourself, wide_awake has suggested a good solution.

Listening...
0
 
LVL 35

Expert Comment

by:girionis
ID: 8216595
 I do not think there is a need to set the cookie filename, just set different unique information in the cookie. Username would do. Then check all the cookies the browser returns with each request against the username of the user logged in.
0
 
LVL 3

Expert Comment

by:wide_awake
ID: 8219021
If the cookies from the site always had the same filename, you'd end up with the same problem.  When the 2nd user logged in, it'd overwrite the first user's cookie, then both users would be pointing to the same data (2nd user's).

Different filenames are a good way to encapsulate all the info.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8219251
 The cookie always has the name you give it therefore if you give it different name (lets say the username in our case) then you can distinguish between cookies since you will only look for the cookie that its name matches the username of the user logged in.
0
 

Expert Comment

by:CleanupPing
ID: 9058469
sethupathi:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9732845
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept objects' comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month12 days, 5 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question