NCS Logo - Click for home page Northstar Developer Center
Platforms
All Platforms
.NET Framework (1.x - 4.x)
Active Server Pages
ASP.NET
C#
SQL Server
VB.NET
Visual Basic

Keywords
.NET Data Types
.NET E-mail
.NET Events
.NET Functions
.NET Object Programming
.NET System.Configuration
.NET System.Diagnostics
.NET System.IO
.NET System.Net
.NET System.Net.Sockets
Active Data Objects
ASP Architecture
ASP Black Belt
ASP Built-in Functions
ASP Built-in Objects
ASP Debugging
ASP Performance
ASP Security
ASP Syntax
ASP.NET Authentication
ASP.NET Controls
ASP.NET Data Access
ASP.NET Features
ASP.NET Master Pages
ASP.NET Page Events
ASP.NET Security
ASP.NET ViewState
Atom
Certifications
COM, DCOM, COM+
Data Access
E-Mail
Errors
Exporting Data
HTML Tips
IIS
Object-Oriented Programming
RSS
SQL
Uncategorized ASP Tips
VB API Programming
VB Forms
VB Syntax
XML

Book Support
Visual Basic 6 Bible
ASP Bible
ASP Weekend Crash Course
ASP.NET At Work
Creating Web Services

State Preservation and the Session Object

Written by Eric Smith, Northstar Computer Systems LLC

A reader wrote asking what the purpose of the Session object is in preserving state. He also wondered how the server determines what data goes with each user if multiple pages are submitted simultaneously.

In most cases, you move from one page to the next by way of either a link or a form submission. Submitting form data is not really a function of ASP – ASP simply lets you get to the data through the Request object. The Session object is not directly related to this basic feature, either. You can code an entire application without ever using a Session variable – in fact, for performance reasons, you should avoid using lots of Session variables.

The Session object has a property called SessionID, which is a unique value generated by the server for each distinct user visiting the web server. This value is stored automatically in a cookie on the user's machine and is passed each time data is submitted to the server. The value allows the server to store Session-level variables for that user. This feature is useful for many different purposes, as has been demonstrated in previous tips on how to create logins that timeout, and so on.

The short answer is that the Session object does not directly impact normal data submission through HTML forms. It can be used to track a particular user's actions through the use of the SessionID property. That feature can allow you to determine how a user moves through your site during a particular visit.

Note that the SessionID value can repeat if the server is rebooted, so don't use it for unique values in databases – stick to the AutoNumber or Identity feature of your database.

Keywords: [ Uncategorized ASP Tips ]

Publication Date: 1/1/2000