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.