The Session object stores information needed for a particular user's session on the web server. It is automatically created every time when an ASP page from the web site or web application is requested by a user who does not already have a session, and it remains available until the session expires.
The Session object is user specific. It can be used to store variables specific to a particular user and IIS will maintain these variables when the client moves across pages within your web site.
The Session object is based on using cookies, so if cookies are not permitted on the client browser (because of firewall issues, browser incompatibility, or desktop/network security concerns), the Session object is rendered useless. The syntax, collections, properties, methods and events of the ASP Session object are as follows:
||The Contents collection contains all the items added to the session through the use of scripts (not through the use of the <OBJECT> tag). The collection can be used to determine the value of a specific item, or to iterate over all the items in the session.|
||The StaticObjects collection contains all of the objects with session-level scope created through the use of the <OBJECT> tag. The collection can be used to retrieve properties of a specific object in the collection, or to use a specific method of a given object in the collection.|
||The CodePage property defines the code page that will be used to display the page content in the browser. A code page is a character set containing all the alphanumeric characters and punctuation used by a specific locale.|
||The LCID property is used to set or get the locale identifier (LCID) of the page is sent to the browser. The local identifier is used to control how dates, times and currencies will be displayed according to the specific location or region.|
||The SessionID is a read-only property that uniquely identifies each current user's session. Each session has a unique identifier that is generated by the server when the session is created and stored as a cookie on the client machine.|
||The Timeout property sets or returns the timeout period (in minutes) for thå Session object in this application. If the user does not refresh or request a page within the timeout period, the session ends. Can be changed in individual pages as required.|
||The Abandon method is used to destroy all objects stored in a Session object and releases their resources. If the Abandon method is not explicitly called, the web server will maintain all session information until the session times out.|
||The Contents.Remove method removes the specified item from the Session object Contents collection.|
||The Contents.RemoveAll method removes all the items from the Session object Contents collection.|
||The Application_OnStart event occurs when a new session starts, before the page that the user requests is executed. |
||The Session_OnEnd event occurs when the user's session is abandoned or times out.|