Expand my Community achievements bar.

BlazeDS Flex Session Issue

Avatar

Level 1
Hi All,

I face an issue in using
flex.messaging.FlexSessionfor handling sessions. Your help
is deeply appreciated.



During user login i use the following line of code to store
to user name in the session.


FlexSession userSession= FlexContext.getFlexSession();

userSession.setAttribute("userid", userid );





When user logs out i use the following line of code to
invalidate / destroy session.




FlexSession userSession= FlexContext.getFlexSession();

userSession.invalidate();





All the server logic is handled by remoteObject (java).



Issue : When "user1" logs in for the first time and then logs
out the session in the server is not invalidated even if
session.invalidate is called.



This behaviour was verified when i used another user to log
in but was able to see the previous username reflected in the
welcome page when i user session.getAttribute("userid");



Why is the session not invalidated in spite of it
session.invalidate call is made..



Please help!!!



-Regards

Venky



2 Replies

Avatar

Level 2
Hi,



Assuming that the session.invalidate() is not working.
FlexContext.getFlexSession() should be returning the session object
for the new user and not the object of the old user who logged off,
more over when another user logs in, shouldn't the
userSession.setAttribute("userid", userid) be overwriting the value
with new userId ??



Can you please check out if something else is going wrong.



Hope this helps.

Avatar

Level 1
Hi SujitG,

Thanks for your response. The issue is resolved and the
mistake was mine. I used flex from the view point of traditional
web programing. On loading a flash page i used the onCreate event
to call the Remote object behind to retrieve the user name. So when
i sign out and sign in as different user , since the call was made
on the Page onCreate event the RO call is not made again to
retrieve the new user name. So i called the RO once the user signed
in and i could see the signed in user name reflected in the flash
screens.



Thanks for your response again.



Venky



So FlexSession in deed works fine and i