Building WebApps  «Prev  Next»

Lesson 9Course Project
ObjectiveWrite session variables to a file in our course project.

Write Session Variables to File using ASP

In this portion of the course project, you will write the code to take the session variables intialized in the previous Course Project exercise and write them out to a text file. Once the variables are captured, you will also write code to display the file.
The next lesson concludes the module.


What is the purpose of the Session Object in Classic ASP

The Session object in Classic ASP is used to store information that is specific to a particular user session on a web application. This information can be accessed and used throughout the user's session, which typically lasts until the user closes the browser or until the session times out.
Session variables are stored on the server, allowing for persistence of data across multiple pages of a web application. This makes the Session object a useful tool for maintaining state and tracking user data, such as user preferences, shopping cart contents, or form data that needs to be passed between pages.
In Classic ASP, the Session object is created automatically when a user first accesses a web application, and a unique session ID is generated for the user to identify their session. The Session object can be used to store and retrieve data using the Session("key") syntax.
You can use the Session object to store information needed for a particular user-session. Variables stored in the Session object are not discarded when the user jumps between pages in the application; instead, these variables persist for the entire user-session.
The Web server automatically creates a Session object when a Web page from the application is requested by a user who does not already have a session. The server destroys the Session object when the session expires or is abandoned. One common use for the Session object is to store user preferences. For example, if a user indicates that they prefer not to view graphics, you could store that information in the Session object.
Note Session state is only maintained for browsers that support cookies.

Syntax
Session.collection|property|method

Create Display - log Records - Exercise

Click the Exercise link below to write and display a log file with ASP.
Create Display - log Records - Exercise