ASP Session Object

A Session object is automatically created by the web server when a web page from the application is requested by a user who does not already have a session. The Session object can be used to store information concerning the user session, since variables in in the object are not discarded when the user jumps between pages in the application.

The server destroys the Session object when the session expires or is abandoned. By default, a session expires after 20 minutes of inactivity by the user.

Properties

CodePage Property
Specifies the server codepage that will be used to display dynamic content.

LCID Property
Specifies the locale identifier that will be used to display dynamic content.

SessionID Property
Returns the session identifier for a user session.

Timeout Property
Specifies the length of time, in minutes, before an idle session is terminated.

Collections

Contents Collection
A collection of all of the items which have been created and added to the Session object during a client's sessions through script commands, such as the Server.CreateObject command, rather than by using the HTML <OBJECT> tag.

StaticObjects Collection
A collection of all of the items which have been created and added to the Session object during client sessions by using the HTML <OBJECT> tag, rather than using script commands.

Methods

Abandon Method
Terminates a user session, destroys all data and objects contained in the Session object, and releases its resources.

Contents.Remove Method (v 3.0)
The Contents.Remove method is used to remove a single item from a Contents collection.

Contents.RemoveAll Method (v 3.0)
The Contents.RemoveAll method is used to remove all items from a Contents collection.

Events

OnEnd Event
The OnEnd event occurs when a Session expires. The signal of this event will run a handler script in the Global.asa file, if the script exists.

OnStart Event
The OnStart event occurs before the start of any new session by a user. The signal of this event will run a handler script in the Global.asa file, if the script exists.

Example OnStart handler script. This script increments an Application scope counter, used to count the number of visitors (unique sessions) since the last time the application was restarted.

  <script language="vbscript" runat="server">
    Sub Session_OnStart
      Application("VisitorCount") = Application("VisitorCount") + 1
    End Sub
  </script>


Back to ASP Objects



Resources:
http://www.devguru.com
http://msdn.microsoft.com/asp/

All code is my own (but I am not responsible for your perception of it)

(v 3.0) indicates that this feature is only available with ASP Version 3.0, which shipped standard with IIS 5.0

Ses"sion (?), n. [L. sessio, fr. sedere, sessum, to sit: cf. F. session. See Sit.]

1.

The act of sitting, or the state of being seated.

[Archaic]

So much his ascension into heaven and his session at the right hand of God do import. Hooker.

But Viven, gathering somewhat of his mood, . . . Leaped from her session on his lap, and stood. Tennyson.

2.

The actual sitting of a court, council, legislature, etc., or the actual assembly of the members of such a body, for the transaction of business.

It's fit this royal session do proceed. Shak.

3.

Hence, also, the time, period, or term during which a court, council, legislature, etc., meets daily for business; or, the space of time between the first meeting and the prorogation or adjournment; thus, a session of Parliaments is opened with a speech from the throne, and closed by prorogation. The session of a judicial court is called a term.

It was resolved that the convocation should meet at the beginning of the next session of Parliament. Macaulay.

Sessions, in some of the States, is particularly used as a title for a court of justices, held for granting licenses to innkeepers, etc., and for laying out highways, and the like; it is also the title of several courts of criminal jurisdiction in England and the United States.

Church session, the lowest court in the Presbyterian Church, composed of the pastor and a body of elders elected by the members of a particular church, and having the care of matters pertaining to the religious interests of that church, as the admission and dismission of members, discipline, etc. -- Court of Session, the supreme civil court of Scotland. -- Quarter sessions. Eng.Law See under Quarter. -- Sessions of the peace, sittings held by justices of the peace. [Eng.]

 

© Webster 1913.

Log in or register to write something here or to contact authors.