When does RO server destroy a dead session

csharp
(FireSide Experience) #1

Hi,

I log in a database when a user logs in and out. How do I know when R.O. has destroyed a session so I can write to the database when the “dead” session was logged out? what event am I looking for?

Thanks!

0 Likes

(antonk) #3

Hello

There are 2 events exposed by the SessionManager:

  1. OnSessionExpired - raised after a session has been marked as expired right before this session is destroyed
  2. OnSessionDestroyed - raised after a session has been destroyed for any reason

Note: It is not recommended to execute any long-running operations directly in the event handler code. SessionManager calls these event handlers synchronously, so any long-running operation might pause execution of the session cleanup code.


You need to take care of both these events.
The OnSessionDestroyed event will be raised when user performs a correct logout process, when server code calls the DestroySession method.
The OnSessionExpired event is raised when a session is killed due to a timeout. This might happen if
the clean logout process was not performed for any reason.

0 Likes