Share via


xSession.terminate Method

Terminates the session ID that the object was instantiated with.

Syntax

public boolean terminate([date loginDate, TimeOfDay loginTime])

Run On

Called

Parameters

  • loginDate
    Type: date
    The date that the user of the session logged on; optional.
  • loginTime
    Type: timeOfDay
    The time that the user of the session logged on; optional.

Return Value

Type: boolean
false if the user is not authorized to perform this function; otherwise, true.

Remarks

This API has a built-in authorization check that is invoked at run time. An exception is thrown if calls to the terminate method are made by users who do not have access to the development security key (SysDevelopment).

The optional parameters allow you to put a timestamp on the session to ensure that it is the session you intend to terminate. The same session ID could be used at two different times.

The terminate method is used in the Online users form to allow administrators to terminate sessions. An administrator might decide to terminate a session because it has stopped responding, is consuming a lot of resources, or its license needs to be freed for another user.

Examples

The following example confirms whether the user has permission to terminate the session. If so, the session is terminated.

server static public void Main(Args _args) 
{ 
    Session session; 
  
    session = new Session(); 
    if (session) 
    { 
        session.terminate(); 
    } 
}

See Also

xSession Class

xSession.loginDate Method

xSession.loginTime Method