Solved

Does HttpSession.invalidate function kill all the sessions?

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

920 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

13 Experts available now in Live!

Get 1:1 Help Now