application|session| objects Second, overview of members of Session objects
The member of the session object has one more attribute than the Application object: Collection, property, method, event
Collection of ⒈session objects
Contents: There is no collection of all variables stored in a particular session object using the <OBJECT> element definition.
Staticobject: A collection of all the variables defined by the <OBJECT> element that are stored in the session object.
Example: The following assignment is available in the Default.asp
Session ("a") = "a"
Session ("B") =128
Session ("C") =false
Then there are contents sets
Session.Contents (1) = "A" can also be written as session.contents ("a") = "a"
Session.Contents (2) =128 ' can also be written as session.contents ("B") =128
Session.Contents (3) =false ' can also be written as session.contents ("C") =false
Properties of the ⒉session object
CodePage: readable/writable. Integral type. Defines the code page that is used to display the content of a page in a browser. The code page is the numeric value of the character set, and different languages use different code pages. For example, the ANSI code page is 1252, the Japanese code page is 932, and the Simplified Chinese code page is 936.
LCID: readable/writable. Integral type. Defines the page area identity that is sent to the browser. The LCID is an international standard abbreviation for uniquely identifying regions, for example, 2057 defines the currency symbol for the current region as "£".
SessionID: Read only. Long integral type. Returns the session identifier for this session. Each session is created with an identifier assigned automatically by the server. Depending on its value, you can determine who two users first access the server.
Timeout: readable/writable. Integral type. Defines a time-out limit in minutes for a session. If the user does not refresh or request any of the pages at this time, the session that the user produces will automatically end. The default value is 20.
The above attributes in the actual application of the role is not, and basically do not need to modify, these properties are no special place.
Methods of ⒊session objects
Contents.Remove ("Variable name"): Removes the specified variable from the Session.Contents collection
Contents.RemoveAll (): Deletes all variables in the Session.Contents collection
Abandon (): Ends the current user session and undoes the current sessions object.
The Contents.Remove ("variable name") and Contents.RemoveAll () method of the Session object are essentially no different from the Application object, to help understand, We can refer to the example above to change application to session. Here is the difference between contents.removeall () and abandon (), and executing both methods releases the current
All session variables for user sessions, except that Contents.RemoveAll () simply frees the value of the session variable and does not terminate the current session, while abandon () terminates the conversation, in addition to releasing the sessions variable Session_ OnEnd event, I hope you pay attention to the difference between the two.
Events for ⒋session objects
OnStart: Triggers when an ASP user session is generated, which occurs whenever any user requests a page on the server.
OnEnd: Triggered when an ASP user session ends, the event is triggered when the abandon () method or timeout is used.
These two events, like application's OnStart and OnEnd events, must be placed in Global.asa documents,
I will focus on the use of these four events.