Session LifeCycle Problem

  

Dear all,


I've been reading about session lifecycle on outsystems and the conclusion I get is that the session will be cleared when:

1) Asp.Net session reached the 20 min timeout

2) Logout is called

3) Some action to clear the session is called

(correct me please if I'm wrong)


Now I keep seeing a strange behavior on my environment, where every time I close the browser window (either IE or firefox) and open the page again the variable session I've created and set up is wiped out.

More clearly, I login a first time, set the session variable and navigate freely on my page. While leaving the browser open and creating new tabs, the value on the variable maintains set. The moment I close the browser window (without logout) and open the page again, the UserName and UserId continued to be set but my session variable loses its value.

Is this a normal behavior ? And why this might be happening? 

Thank you for the help.

André

Solution

Hi André,

Taking the .NET stack as example, the underlying ASP.NET session is identified using a session cookie (ASP.NET_SessionId). Because it is a session cookie, it will be removed when you close the browser, thus your session variables will be lost (because this cookie will be generated again when accessing the app).

If you use the 'remember me' option when logging in, another cookie (with an expiration date) is used to log you in again. But the ASP.NET_SessionId cookie is still generated again.

Bottom line is, if you need to persist data in that scenario, use your own data model instead of session variables.

Cheers

Solution