Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Catch Timeout
#1
Hi,

Is it possible to catch when a user reach the timeout and redirect them to a specific page?

I don't mean to keep the session alive. I want to do something like WebApplication.TerminateAndRedirect('https://xxx.yyy.com/Default/TimedOut.Htm');
Reply
#2
According to this thread https://www.atozed.com/forums/archive/in...-2370.html, you can use IWExceptionRenderer to intercept an invalid session and then redirect.

The example project is here https://github.com/Atozed/IntraWeb/tree/...ionTimeout
Reply
#3
(02-19-2023, 06:04 PM)Xenogall Wrote: According to this thread https://www.atozed.com/forums/archive/in...-2370.html, you can use IWExceptionRenderer to intercept an invalid session and then redirect.

The example project is here https://github.com/Atozed/IntraWeb/tree/...ionTimeout

This example restarts a new session. That is not what I want. I just want to show a nice html that explain why the user was terminated
Reply
#4
I use the IWExceptionRenderer with SessionOptions->RestartExpiredSession = false and no redirect in the html as used in the example project.  It does not seem to create a new session:

[Image: clip0003.png]
Reply
#5
(02-21-2023, 06:24 PM)MJS@mjs.us Wrote: I use the IWExceptionRenderer with SessionOptions->RestartExpiredSession = false and no redirect in the html as used in the example project.  It does not seem to create a new session:

[Image: clip0003.png]

Thanks. How to call URL? What's in your code to create that html?
Reply
#6
1) You can use a static HTML file as template for your timeout exception page. I believe that's the simplest and most effective way to deal with this if you don't need to show dynamic content. It *does not* create a new session, but can contain a link so the user can explicitly start a new one. Templates are partially processed (some tags/variables can be used within the HTML so it can still present some dynamic content.

This example shows how to do it: https://github.com/Atozed/IntraWeb/tree/...gTemplates

2) You can subclass the IW Exception Renderer, and generate a custom, dynamic HTML whenever an exception (including the session timeout) happens. This is the simplest way to create dynamic content, if you need to. This also *does not* create a new session.

This example shows how to do it: https://github.com/Atozed/IntraWeb/tree/...onRenderer

3) You can also use a mix of everything, redirect to a custom URL within your application domain and catch this with a Content Handler, registered for that specific address. The content handler can still work without a session. This is more complex than both options above, but possibly is also the most flexible.

I suggest you going with 1 or 2 above.

Please notice that you can't actually rely on the session counter on the SA application main form because, when a session timeout exception occurs, the original session (the one that has expired) may or may not have been destroyed, so the session counter may still show it. The session will be certainly destroyed within 1 minute (after being expired) in a background thread.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)