Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Session timeout not working
When I set the session timeout in a ISAPI project it doesn't work, in a standalone project it works as expected.
I am using 15.1.16.
I have tried setting it both from the object property in the IDE and from code: UserSession.WebApplication.SessionTimeOut := 1;
Doesn't anyone know if this is a bug or a misunderstanding from my side.
In standalone the session becomes invalid when press e.g. a button after timeout, and the timeout screen is shown, so I know what to expect.

I run without cookies because there was a problem with CORS when showing the form in a IFRAME on a web page in another domain, and I'll have to test if .22 have solved this problem maybe, but any upgrade could break a 100's of things so I wait even if .16 seems to be buggy in a few places.

Regadrs Martin
I'll let Alexandre handle the time out question but for CORS you need to enable it in the SC options.
Session timeout works correctly in ISAPI applications in latest version 15.1.22 regardless of your cookie settings.

I don't know exactly what you suspect that will break when upgrading but I don't think it is accurate.
Hi there,
And in HTTP? (is there an explaination which for which application to use)

I have set the sessiontimeout to 1 and keep it alive with a trick I found:
The sessions on which the browser is closed did last about 25 minutes.
And as it should be, the one with the browser running stays alive. 

How do I bring the 25 minutes back to 1 minute?
When you use that method, it basically pings the server. So long as it keeps pinging, it will never "timeout".

"and in HTTP?"

This makes no sense. Are you asking about http.sys?
I'm not sure what your situation is, but I'll quickly outline setting the values for form KeeplAlive and timeout:

1. Set the Session Timeout to whatever value you want. I believe default is 1 or 5 minutes (I don't remember, I explicitly set it). If there is no response from a form after that time, the session is flagged for destruction. The session technically still exists until IW does a scheduled cleanup and removes sessions that are "shut down". In your case, I think you want this set to 1 minute based on your comment.

2. IWForm.KeepAlive (NOT the IP Keepalive... this is on the IwFORM), set to true and it will automatically ping the server when that form is displayed, regardless of what the user is doing. This will keep the session from timing out. It will ping 3 or 4 times during the timeout period (that is, ping frequency is set by timeout). All of that is automatic.

With that setup, if a form is showing with KeepAlive set to true then the session will never time out. If you kill that browser window (form is shut down), the session will time out in based on the setting.

Exception: Some browsers (ex: Safari on iPhone) deactivate a form when it is not showing, even if the form is not closed. So, the session may time out if you bring up another app or even browser window. On a desktop, if the browser window exists it will continue to stay alive.

It shouldn't matter in this situation, but it is helpful if you can state your IW version and Delphi version along with the settings you have tried and the behavior you have seen.

Hi Dan,
Thank you.
Using Delphi 10.3, Intraweb 15.1.21
LockSessionTimeOut 30000
When I call WebApplication.Terminate the session is terminated imediatly
When I close the browser without closing the application the session remaines about 25 minutes
Retest using the GuessISAPI demo.

Its possible that code you have added to your application is interfering with session shut down.
Do you have a simple link for downloading the demo?
Guess I think may be part of the installation, if not look in our demo repository which is linked on our download page and I think there is a shortcut in the program group as well.

Forum Jump:

Users browsing this thread: 1 Guest(s)