Solved

Does HttpSession.invalidate function kill all the sessions?

Posted on 2004-04-07
3
678 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 50

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 50

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VPN Dedicated IP address question 7 45
Problem to Eclipse 16 125
Tool to email me when a website changes 29 130
.htacess file 301 redirects that are strange 4 56
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…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 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