Home > DeveloperSection > Forums > How to use invalidate session?
Samuel Fernandes
Samuel Fernandes

Total Post:155

Posted on    October-06-2014 1:03 AM

 Cold Fusion C#  Cold Fusion 

 1 Reply(s)
 946  View(s)
Rate this:

When do you call getPageContext().getSession().invalidate()?

I tried calling that at the logout page, then cflocation it back to the main page, and it throws exception.

How to assign a new session right after?

Kamlakar Singh
Kamlakar Singh

Total Post:194

Posted on    October-06-2014 1:07 AM

getPageContext().getSession().invalidate() will invalidate the session, subsequent request with that sessionID will get an error trying to access the Session scope but the memory will not be reclaimed until the actual session timeout.

What you can do is session.setMaxInactiveInterval(int) set it to very a low number in ms so it expires right away and release the memory. Then do a cflocation and for safe mesure use addToken="no"

Don't want to miss updates? Please click the below button!

Follow MindStick