How Does Client Determine That Session Expired

In Delphi DataAbstract, how can we determine on the client side that the client session has expired on the server before we make another data request?

Now that we are into heavy testing of certain areas of our programs, we are running into session expirations after the tester leaves for an extended period of time and leaves the program running. Very common scenario at an office. We want to catch that the session expired before the next data query is run and then relogin. Just need to know if the session has expired or not.

On client sessions, what determines on the server that the session should be still active and the time allotted for an active session to be extended? Not the initial time allotment, but the additional extended time if the session is currently being used and not inactive past the initial set time.

So what is the best case for handling that or do we just continually set a timed query to run a quick one record query to keep the session active?

I looked for similiar topics but did not find an exact answer. I thought someone had this question several months ago but could not find it.

Thanks ahead of time.
Bill Brittain

Hi,

on client-side you can’t detect that server-side session was expired.

some ideas:

  • you can call SessionManager.CheckSessionIsExpired on server-side. it can check current state of session.
  • you can return Session.LastAccessed value to client-side. it will be approximate time when session will be expired.

if you want to prolong session on server-side you can call a custom server-side method of protected service. it will update the LastAccessed property of session