KillStaleSessions Method
- Last UpdatedNov 06, 2025
- 1 minute read
The KillStaleSessions() method terminates any sessions that have not been refreshed for a period of time, for example, when a client application terminates abnormally.
'Declaration
Public Shared Sub KillStaleSessions( _
ByVal sessionId As Integer, _
ByVal minLimit As Nullable(Of Integer) _
)
'Usage
Dim sessionId As Integer
Dim minLimit As Nullable(Of Integer)
Session.KillStaleSessions(sessionId, minLimit)
public static void KillStaleSessions(
int sessionId,
Nullable<int> minLimit
)
Parameters
- sessionId
Required. Holds the session ID and thus the user who is making the request.
- minLimit
- Optional. Holds the threshold number of minutes within which all sessions should have been refreshed to prevent being killed. The defaults is 10 and the minimum value is 2.
This method deletes all the sessions whose last_heartbeat value is older than the specified number of minutes from the current time. Additionally, if entity logon records are linked to this session (user only), then those records are automatically removed.
This method is useful when a client application terminates abnormally, or there is a left-over session in the database, and so on.