A session is active if the user has logged on to a valid session dictionary using CTSession.Logon(). To render a session inactive, log off using CTSession.Logout(). To verify the status of the session, use CTSession.IsActive().
//if session is active, retrieve the server name and user logon name
if (ASession.IsActive())
{
Console.Write("Server name: {0}\n", ASession.GetServerName());
Console.Write("User name : {0}\n", ASession.GetUserLogonName());
}