RAD Studio |  |

Using the Sessions Service

The sessions service, which is an object of type TSessionsService, keeps track of the users who are logged into your Web server application. The sessions service is responsible for assigning a different session for each user and for associating name/value pairs (such as a username) with a user.

Information contained in a sessions service is stored in the application's memory. Therefore, the Web server application must keep running between requests for the sessions service to work. Some server application types, such as CGI, terminate between requests.

Note: If you want your application to support logins, be sure to use a server type that does not terminate between requests. If your project produces a Web App debugger executable, you must have the application running in the background before it receives a page request. Otherwise it will terminate after each page request, and users will never be able to get past the login page.
There are two important properties in the sessions service which you can use to change default server behavior. The MaxSessions property specifies how many users can be logged into the system at any given time. The default value for MaxSessions is -1, which places no software limitation on the number of allowed users. Of course, your server hardware can still run short of memory or processor cycles for new users, which can adversely affect system performance. If you are concerned that excessive numbers of users might overwhelm your server, be sure to set MaxSessions to an appropriate value.

The DefaultTimeout property specifies the defaut time-out period in minutes. After DefaultTimeout minutes have passed without any user activity, the session is automatically terminated. If the user had logged in, all login information is lost.. The default value is 20. You can override the default value in any given session by changing its TimeoutMinutes property.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!