Khurram's World - Session Object [ASP]
..Islam and Religion
 .Computer & IT
  Web Designing TIPS
..HTML & DHTML
..Active Server Pages
..JAVA & JAVA Applets
..JAVA & VB Script
..CGI & Perl
..Electronic Commerce
..Web Sites & Emails
 
Pakistan News Service
BayCareer Banner

ASP Built in Objects and Components

Response Request Server
Session Application Components
     

Session Object

In an ASP application, a session has a more specific meaning. A session begins when a browser instance requests a page in your application, and ends when you abandon the session ia code, when the session times out, or - if the browser refuses the session cookie - immediately.
An ASP session is specific to a given cookie. That can be confusing because a cookie and a single browser are not the same thing. Bear in mind that the ASP engine identifies sessions by looking for the existence of an ASPSESSIONID cookie. You may have more than one browser window open and attached to the same session if both browsers have the same cookie.
ASP's reliance on cookies can cause problems because some people set their browsers to refuse cookies.
Syntax
Session.property
Session.Method
Session.Collection

Session Object Property

Property Description
CodePage Sets or returns the code page used for mapping characters and symbols. The default is 1252 (American English). Sets or returns a Locale identifier. You can also set the locale with the @LCID directive. Setting the Session.LCID property
LCID overrides the @LCID setting. Use this to output dates and currency values in the preferred format for the specified locale.
SessionID Read-only. Returns the SessionID for the current session. The value returned by the SessionID is unique for the instance of IIS. It is not globally unique; it is only unique to a user during the duration of a single IIS instance. Therefore, if your cycle your server, the value may repeat. Avoid storing user data keyed to a specific SessionID value for data that you need to persist across session.
Timeout Specifies, in minutes, the time until the ASP engine will destroy an inactive session. The default is 20 minutes in IIS 4.0 10 minutes in IIS 5.0.

Session Object Method

Method Description
Abandon Destroys the session and all objects stored at session scope. The ASP engine doesn't actually destroy the session until page-processing completes.
Contents.Remove Removes an item from the session.Contents collection. The Session.Contents collection contains all Session variables except those added through and <object> tag with session scope.
Contents.RemoveAll Removes all items from the Session.Contents collection. You might use this method to clear a session before abandoning it.

Session Object Collections
Collections Description
Contents The Session.Contents collection contains all Session variables except those added through an <object> tag with session scope.
StaticObjects Contains the collection of objects defined with <object> tags at session scope.

Session Object Events
Events Description
Session_onEnd Occurs just before the ASP engine destroys the current Session object. You should use this event to destroy any objects stored at session scope.
Session_onStart Occurs just before the ASP engine creates the current Session object. You should use this to create objects and initialize variables with session scope. .