Solved

Does HttpSession.invalidate function kill all the sessions?

Posted on 2004-04-07
3
664 Views
Last Modified: 2008-02-01
I have 2 webserver, each one tied with an app server.  The session timeout has been set to 4 hours.  But sometimes after couple of minutes, the user is kicked back to the login page.  I am not sure if HttpSession.invalidate is the cause?  Pls advise.

Thanks.
0
Comment
Question by:radha77
  • 2
3 Comments
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 10781227
Yes, the invalidate() method DID kill all the sessions, to kill only a particular session object, try use the removeAttribute method:

Example:

<%

session.setAttribute("test", "124");

out.println(session.getAttribute("test")+"<br>");

session.removeAttribute("test");

out.println(session.getAttribute("test")+"<br>");

%>

Hope this helps
0
 

Author Comment

by:radha77
ID: 10783804
Thank you.  I have another question ... What is "test" and "124" in session.setAttribute("test", "124");  Is that any random name, or does it have to be the userid?  Pls advise.

Thanks.
0
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 250 total points
ID: 10789232
>>Is that any random name, or does it have to be the userid
Possible, above is just an example on how to kill a particular session object. "test" will be the object name, while "124" is the value associated within the session object.

Hope this's clear, cheers :-)
0

Featured Post

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now