Handling session timeout

0
0

Is it possible to modify the session timeout handling this way:

a) The built-in reminder dialog should not be displayed,

b) The WiseJ dialog indicating the timeout and closing the browser window should  be suppressed.
Instead a client side dialog should be displayed showing a information message and allowing the user to reload/restart the website/session or close the browser window.

  • You must to post comments
0
0

I now have implemented it the following way:

  1. Handling in “Application.SessionTimeout”:
    e.Handled = true;
    Application.Exit();
  2. Display message client side:
    Wisej.onExit = function () {
         alert(‘Your session timed out ! Please reload…’);
    }

If “Application.SessionCount” does correctly display the server session count (in v2.2.49+) the way it now seems to work does fit my requirements.

  • You must to post comments
0
0

Hi Luca,
my intention is to free the server session & and its resources if the users leaves the application without closing the browser-tab.
Up to know I’ve managed to implement the display of a client side javascript box informing the user about the timeout  (based on Kevin’s suggestions if the timeout happened) but as I understood the session on the server  keeps alive then?
So I thought about something like “WiseJ.Exit()” to call on the client side to exit/kill the session sooner or later on the server too but without the need to close the browser tab…

  • You must to post comments
0
0

Wisej.Core.exit() but the result is the same.

It’s unclear what you need to do.

  • If you want to suppress the built-in form, use e.Handled = true and terminate the session using Application.Exit()
  • If you want to display a javascript dialog on the client, add this to Default.html:
<body>
 <script>
   Wisej.onExit = function () {
      var box = new wisej.web.MessageBox().set({
          title: "Test",
          message: "Message",
          image:"information"
      });
     box.show();
 }
 </script>
</body>

There is no other option. It’s either client only code or server code with a session.

You can use all Wisej widgets in javascript or use any other widget from any javascript library. See how to display a message box above. All the widgets are available here:

https://github.com/iceteagroup/Wisej-qx
https://github.com/iceteagroup/Wisej-js
https://github.com/iceteagroup/wisej-js/blob/master/wisej.web.MessageBox.js

The code is all self documented. The syntax is the standard config json syntax of all libraries.

HTH

 

 

 

  • You must to post comments
0
0

So is there a possibility to “kill” the session (and free server resources) from client side ?

  • You must to post comments
0
0

Hi Tobias,

No it’ll be free when Application.Exit(), it terminate session and all data stored are terminated,

But Application.Reload(); continue to persist session data

Best,

Kevin (ITG)

  • You must to post comments
0
0

Thanks a lot for your sample.
A final question regarding your implemented solution: Will the server resources (session) be freed even when the javascript dialog stays displayed in the open browser tab ?

  • You must to post comments
0
0

Hi Tobias,

I create a sample for this case.

Best,

Kevin (ITG)

 

  • You must to post comments
0
0

Thanks for your answer, Kevin.

Is there any further documentation or sample available how to implement a custom SessionTimeoutForm ?

I would give that a try but my requirement is a little different. Let me try to explain in more detail:

I await that many of my users will use the app and leave the browser open if the work is done.
To free up server (session) resources I do not need to remind them that the session is running out in a few minutes and want to suppress this “server-side” dialog.
Instead once the session timeout occurs I want to display them a message in their browser window (e.g. by javascript using alert or SweetAlert) which displays that the session has timed out and they can close the browser window or reload the application. If possible at this time the session on the server  should be already killed to save resources but the browser window showing the message may not be closed…

I’ve tried something like this:

private static void SessionTimeoutHandler(object sender, System.ComponentModel.HandledEventArgs e)
{
Application.CallAsync(…<display client side timeout message>…);
e.Handled = true;
}

But this seems not to kill the server side session and the message is displayed again after configured timeout period !?

Please let me know if you have any questions.

  • You must to post comments
0
0

Hi Tobias,

For first, you can handle Application.SessionTimeout directly on program.cs, it’ll help you for the next.

For second, extend SessionTimeoutForm for create your own design, your eventS with syour own buttonS and create an instance on Applicaion.SessionTimeout handler for subscribe SessionTimeout event

For the case: “continue session” you can use Application.SetSessionTimeout() for add more time in session

For the case: “quit session” set e.Handle = true; for finish your session

Best,

Kevin (ITG)

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.