I want to ask how i can preserve session variables. I have a broker application and a broker might sit with a person for an hour or more. Right now it automatically logs you out after 20 mins of being idle and the session losses the userId, Session Id etc and sets all values to Null().

I am looking for a solution to use that will enable the broker to return back to the existing session without the session variables expiring and being set to Null(). I want the broker to be able to complete the process without having to login again yet the previous session is lost completely.

I was thinking that it can fetch the last session/log saved and return that but the problem with such a solution is if we have 2 or more brokers sitting with clients and they are all logged out after 20 mins how then will it know this session was for this particular broker. 

How best can i handle this situation yet preserving security?

Hello Rudo,

One way around is as session losses the userId and session Id after 20 mins,you can increase the Login session timeout to the required value.

Hopefully,Login Session Timeout helps you

Hi Rudo,

You can change the default idle time after which a session expires. We use the Factory Configuration application in the OutSystems Forge for that when you are using an OutSystems infrastructure in the OutSystems Cloud.

After you have installed this application in your environment you can open the application and go to Shared Configurations, you should create a new record with the following options:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="https://www.w3.org/1999/XSL/Transform">
   <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
   <xsl:template match="@*|node()">
           <xsl:apply-templates select="@*|node()"/>
   <xsl:template match="/configuration/system.web/sessionState">
           <xsl:attribute name="timeout">480</xsl:attribute>
           <xsl:apply-templates select="@*|node()"/>

The 480 is the timeout in minutes. 

Last thing you will need to do is add this configuration to the modules you want to apply it. Good luck!

Kind regards,
Martijn Habraken

Rudo, an alternative is to send a "keep-alive" request every 10 minutes or so. It's possible to do that in JavaScript, and it would keep the session alive as long as the browser is open.

Hi Rudo,

a completely different alternative, would be to somehow model these broker-client conversations, into a 'dossier' or 'consult' type of entity, and everything you want to 'remember' during the whole of these broker-client sessions can be stored in there.  

This way, nothing is lost when a session ends, but it also allows for the business process between broker and client to take place over several days, or to move it to another desk/computer, or to have another broker take over, without losing any choices/settings/searchoptions/...