Hi !

In my web application I want to obtain the browser timeout info: either the timestamp the session will end, or the timestamp the session started plus the session timeout in minutes will do fine.

How can I do this ?

Cheers, Richard

Hi Richard,

the session timeout is not browser-decided, it's a configuration you set on your web application server. The most common default setting for web servers is 20min.

Hi Richard,

Why you need it?

If you need it to be a different value, you can customize it with the factory configuration component

https://www.outsystems.com/forums/discussion/34866/how-to-change-the-session-timeout-in-factory-configuration/

Regards,

Daniel

Hi guys,

Thanks for the responses but I'm not sure you understood my question.  I want to obtain either the timestamp the session will end, or the timestamp the session started plus the session timeout.

Cheers, Richard.

Hi Richard,

The timestamp the session started plus the session timeout is useless... the timeout countdown is reset every time the user interacts with the server.

If you want to determine when the countdown for timeout starts, you can can go to the Logic tab, right-click on the Server Actions folder, select Add System Event and then On Begin Web Request. This will create an action that will run every time your module handles a new request. Here you can store in Session variable, or in an Entity the last time it was "touched". If you know the timeout (this is a server configuration), you can determine the timestamp the session will expire. You would need to add this to every module you want to collaborate to determine this info though.

Another option is adding to the default Layout of your screens a Web Block that doesn't have any UI but on its preparation does the same kind of logic. Screens that are built afterwards will include this by default, older screens you will have to manually add the Web Block to them.  

Richard,

What is it that you try to do with that the session timeout information?

Regards,

Daniel

Daniël Kuhlmann wrote:

Richard,

What is it that you try to do with that the session timeout information?

Regards,

Daniel

Hi Daniel,

Firstly I would like to send the user a message when they have timed out.  Optionally for some critical workflows I would like to give them a 2 minute warning.

Cheers, Richard


Jorge Martins wrote:

Hi Richard,

The timestamp the session started plus the session timeout is useless... the timeout countdown is reset every time the user interacts with the server.

If you want to determine when the countdown for timeout starts, you can can go to the Logic tab, right-click on the Server Actions folder, select Add System Event and then On Begin Web Request. This will create an action that will run every time your module handles a new request. Here you can store in Session variable, or in an Entity the last time it was "touched". If you know the timeout (this is a server configuration), you can determine the timestamp the session will expire. You would need to add this to every module you want to collaborate to determine this info though.

Another option is adding to the default Layout of your screens a Web Block that doesn't have any UI but on its preparation does the same kind of logic. Screens that are built afterwards will include this by default, older screens you will have to manually add the Web Block to them.  

Hi Jorge,

Thanks for the suggestions.  For a warning before a timeout on a critical workflow the first suggestion might work, but for a message after timeout both incur a large overhead and are probably overkill.  For the latter I think I might raise an idea with Outsystems for them to create a new Timeout Exception.

Cheers, Richard.

Hi Richard, 

A Timeout exception would be thrown only when the user tried to reach the server, after the timeout happened. 

This is because the server just do not keep any information about users or requests in memory. After a response is sent back to the client, the server just forgets everything about the request made. The client simply doesn't exists anymore for the server. It would never know when the session would timeout. 

Actually, if the user makes a request to an anonymous page after the timeout, the session is reset, but other than that the user may not even notice. 

If the request is for a non anonymous page, a security exception will be thrown. 

A timeout exception, on this context, could be still interessant, but... 

Cheers. 

It's possible,


You have to know upfront what the IIS session timeout is. by default 20min, but it can be different :)

In any case, create a webblock. This will be included in your layout_webblocks, so that every screen is using it.

In the prep you (re)set a cookie -> this way the you keep having the samish sliding timeout..

With a simple js-heartbeat mechanism, you check the time with the cookie and call a fakenotify for example

if the timeout is within 2 minutes, then the fakenotify is called and you do a popup or something like that.

that logic is of course in that same webblock.


TL;DR; keep a cookie updated by actions on the server and use js-heartbeat to check the cookie and act accordingly




J, the pop-up would have to be done in Javascript, no? The fakenotify would reach the server and reset the counter... 

Eduardo Jauch wrote:

J, the pop-up would have to be done in Javascript, no? The fakenotify would reach the server and reset the counter... 

No. It's a ajax-request, so the prep will not get hit. (and to be sure you might want to add some more info etc. etc.)

but it really does not matter, because at that point in time you are going to show the popup. preferably locking the screen of course ;)