Session Management

Last Updated: 9/21/2008



Sections above here:
Home  »  Development  »  Session Management

Sections below here:

    Topics in this section:
    Session Management
    Session Implementation
    Storing Additional Data
    Session Related Events
    Memory Consumption
    How Session Management Works

    Search Documentation:

    WebApplication Object

    TIWApplication is to an IntraWeb application, what TApplication is to a standard Delphi application. Like the latter, TIWApplication is not a visual component. It does not appear on the property panel and therefore does not have published properties. However, it has a number of public properties and methods that can be accessed via code in the IW application. For each user session, a TIWApplication object is created. It represents the user's "application" or session. In IntraWeb for Visual Studio .NET the application class is IWApplication, and has exactly the same role as the TIWApplication has in IntraWeb for Delphi.

    The users application can be accessed in several ways.

    WebApplication Property of the Form

    In any event or method of your forms you can simply use WebApplication which will reference the form's WebApplication property. This will meet the requirements in nearly all cases. However some notable exceptions where this property is not accessible are global procedures, TFrames, datamodules, and non IntraWeb classes.

    WebApplication Property of a Control

    The base IntraWeb control also contains a WebApplication property that can be used when writing custom controls.

    WebApplication ThreadVar

    In code that is not contained inside of an IntraWeb form or component, the threadvar version can be accessed. This is especially useful in global procedures, or in TFrame code in Delphi IntraWeb applications, or user control code in IntraWeb applications for Visual Studio .NET.

    Lifetime

    A users session is automatically managed by IntraWeb. When a new session is started IntraWeb will create a new instance of a TIWApplication (or IWApplication in Visual Studio .NET) for the user and track it automatically. It can then be used to acquire information about the user, control the users session, or store additional information. No management on the developers part is required to implement session management, or to track the user.

    A session exists until it is manually terminated by calling one of TIWApplication's terminate methods, or a timeout occurs. If a user does not access the application within a given time period, the user's session will be destroyed. The default timeout period is 10 minutes, but can be adjusted by changing the SessionTimeout property in the applications ServerController.

    Note: To store session related variables, create members of the TUserSession class (UserSession in IntraWeb for Visual Studio .ENT).

    Note for Delphi users: Do not work with variables declared in the var section, as these are global to all threads and won't reflect session data properly.



    (C) 2002-2009 - Atozed Software Ltd.