In addition to the objects used to send (Response), receive and process data (requeest), server access (servers) in an ASP object, there are some very useful markup active Object for the server application (application) and individual user information (session).
Session Object
This object accounts for a significant proportion of ASP usage. Because the Web page is a stateless program, the user browsing State is not known. In ASP, through the session object to record the user's private data variables, as users again to request the server to confirm, users in the program's Web page jumps between the existence of the session object variables will not disappear.
These are really important features, especially if a member's system has to be used. Like a member's login account, time, status, and many of the recorded real-time data (such as the shopping system records the user's basket of goods), this information belongs to the user's private needs, usually developers are using the session record processing.
in the ASP session is composed of cookies, the server will be all the data recorded in the session, in the form of cookies to the user's browser. Usually the browser will save these cookies, every time the user click on the link, again with the server online, the browser will send these cookies back to the server for processing: this is the operating principle of the session. This allows session-state sessions to be preserved only in browsers that support cookies, and if the client turns off the cookie option, it won't work.
One, Session.SessionID
The
SessionID property returns the user's session identity. When you create a session, the server generates a separate identity for each session, and the session identity is returned with the long shaping data type. In many cases SessionID can be used for WEB page registration statistics.
Use this attribute to solve a problem of user control. The main function of the problem is that a module for a Web site, when a member is looking at this module after login, another person to log in with the same member name, you can not browse this module: that is, a member name can only one person browsing this module.
Control is achieved by using a member name (assumed to be userid, unique) and SessionID. When the member logs in, give this member a session record login status such as: Session ("Status") = "logged", at the same time the member's Session.SessionID written to the database. When he wants to browse this module, first determine whether it is logged in, if you have logged in again to determine whether its sessionid is the same as the database records, if different can not access.
this way, when another user logs in with the same member name, the new SessionID is recorded in the database, and the former cannot pass the check when accessing the module. This realizes a member name and can only browse a module by one person at a time. This feature has a special role in a number of toll sites, it prevents a member name for many people to browse the problem, for the company to protect the interests.
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