Unveil ASP secrets (5)

Source: Internet
Author: User
Session object
    
Author: mi Xiansheng
    
We can use the Session object to store the information required for a specific user Session. When a user jumps between pages of an application, the variables stored in the Session object are not cleared, and the variables always exist when the user accesses the page in the application. When a user requests a Web page from an application, if the user does not have a Session, the Web server automatically creates a Session object. When a session expires or is abandoned, the server terminates the session.
You can manage Session objects on the server by sending a unique Cookie to the client program. When a user requests a page in an ASP Application for the first time, ASP checks the HTTP header information to check whether a Cookie named ASPSESSIONID is sent in the message. If yes, the server starts a new session and generates a globally unique value for the session. This Cookie is used when the value is sent to the client as the value of the new ASPSESSIONID Cookie, you can access the information of the customer program stored on the server. Session objects are most commonly used to store user preferences. For example, if you specify that you do not like to view images, you can store the information in the Session object. In addition, it is often used in the process of identifying customer identities. Note that the Session status is retained only in the browser that supports cookies. If the cookie option is disabled, the Session cannot be used.
    
I. Attributes
    
1. SessionID
The SessionID attribute returns the user's session id. When creating a session, the server generates a separate identifier for each session. The session id is returned as a long integer. In many cases, SessionID can be used for WEB page registration statistics.
    
2. TimeOut
The Timeout attribute specifies the Timeout period for the Session object of the application in minutes. If the user does not refresh or request the webpage within the timeout period, the session will be terminated.
    
II. Method
The Session object has only one method, namely, Abandon. The Abandon method deletes all objects stored in the Session object and releases the source of these objects. If you do not explicitly call the Abandon method, the server will delete these objects once the session times out. When the server finishes processing the current page, the following example releases the session status.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.