How JSESSIONID is created

Hi Guys

I would like to find out how JSESSIONID is actually created. Also is it unique everytime it is craeted. I tried logging in an application with a userid and note down the JSESSIONID. After logging out I logged in again using a different login information but the JSESSIONID remained the same. Would anyone know how I can make them unique to a particular user if that is possible.

Thanks
huzefaqAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
> Also is there a way that at the login time I can make sure that a new JSessionID is produced

u don't need to. You should though be invalidating the existing session before logging in.
In fact you don't need to concern yourself at all with jsessionid


HttpSession session = request.getSession(false);
if(session!=null) {
   session.invalidate();
}
session = request.getSession(true);
0
 
CEHJCommented:
>>After logging out I logged in again using a different login information but the JSESSIONID remained the same.

That sounds very strange. Can you reproduce it?
0
 
huzefaqAuthor Commented:
yes I acn reproduce it. Does this happen because I am using the same browser.
Also is there a way that at the login time I can make sure that a new JSessionID is produced

Thanks

0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
CEHJCommented:
Are you in control of the web app?
0
 
huzefaqAuthor Commented:
yes I am testing this in my local was server
0
 
CEHJConnect With a Mentor Commented:
The following shows how the session can be managed

http://www.informit.com/articles/article.aspx?p=332851&seqNum=4&rl=1
0
 
objectsConnect With a Mentor Commented:
sounds like u maybe have a problem with logging out, or a caching problem.
check when you logout that the session is getting invalidated.

(yes it will be different for a different session)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.