Skip to content

Sessions and Persistence

Web Application Server Session

A Web Application Server session is defined as any user interaction with an instance of a Web Application, from the time the instance of the application is started until the time it is closed. This time range could be from a few seconds to hours, or even days.

A Web Application is assigned an idle time-out. If no interaction occurs within a specified instance of a Web Application during this time period, it will automatically close to free up resources for other instances.

Therefore, a Web Application Server session encompasses all interactions of a specific user with the Web Application, where a user is defined as any instance of a web browser requesting information from the Web server.

There could be two instances of a web browser running on a single machine, both interacting with the Web Application. Each web browser instance is considered a separate user and is thus assigned a separate Web Application Server session with a separate instance of the Web Business Process Object.

Persistence

A persistent connection means that a single browser has sole access to a Web Application WBO instance. The DataFlex Web Application Server supports persistence and takes advantage of it to improve performance, but it does not rely on a persistent connection. This is an appropriate model for the Internet because there is no way to guarantee a persistent connection.

The Web Application maintains state information within the ASP session and within the WBO. Although it maintains state information within the WBO objects, it currently does not rely on this persistence. Every time an ASP file makes a request of a WBO, the Web Application completely restores the state of the WBO.

This information is based on data that is stored in and posted from the HTML file. Each HTML file contains a record map of the WBO’s DDO structure, allowing that structure to be rebuilt at any point. In addition, each HTML file contains all of the changed data that can be used to alter the DDO structures as needed. Therefore, persistence is not required in a Web Application data entry program. If a session times out, the browser can still reconnect to the web server, start a new session/application, and proceed with the data provided in the HTML file.

When a web browser makes a request for an .asp file, ASP checks to see if the current user has already started a session. It does this by looking for a cookie in the browser environment.

Special Note

If the browser does not support cookies, it will not be able to support persistence. Your application will still run, but it will be slower because you will be starting a new program each time you make an ASP page request.

If ASP does not find the appropriate session cookie, it will:

  • Start a new session and application for the user.
  • Start a new instance of the Web Application WBO program.
  • Assign a unique session ID.
  • Store the session ID as a cookie on the browser and then process the ASP page.

If ASP finds the appropriate session cookie (as it would the next time the browser requests an .asp page in the application area), it will process the ASP page using the Web Application Server session that has already started. This session will remain active until the user (or the ASP file) kills the session or a time-out period is exceeded. Once a session is initialized, the web browser may access any file within the application area and continue to run the same WBOs—no program reloading is required.

Two techniques are available to the developer to enable persistence: cookies and ASP session variables. Neither of these features is used automatically or required, but they can be added to your application. Creating browser cookies is the standard method used for maintaining state in a web transaction. All of your choices are stored in browser cookies, which are not passed to the web server until the entire transaction is processed.

Normally, you are discouraged from saving a great deal of information in cookies. A Web Application does not need to use cookies, but they are available if needed. Session variables are an ASP feature, allowing you to store information for a session at the server. As long as a persistent connection is maintained, your ASP file can query and access the session variables as needed.

See Also

Important Concepts and Options