Summary of the start end method for ASP. Application and Session

Source: Internet
Author: User

After a few days of groping, test, today can finally be application and session object of start and end method to do a summary.

Application_Start: The first user to access the site will trigger the method. Some system variables are usually defined in this method, such as the total number of online chat rooms, the initialization of historical visitor demographics, and so on.

Application_End: This method is triggered when a Web site is closed or restarted. No excessive experimentation was carried out.

Session_Start: triggered when each user accesses the first page of a website;

Session_End: Session.Abandon () is used, or the session timeout is triggered after the user exits.  Note that the Session object, server object, Server.MapPath () cannot be used in Session_End. So you can only replace the session ("username") with session.contents ("username"). or using application objects or methods;

For example, to use Server.MapPath ("Users.xml") in Session_End, you should define application ("Xmlpath") in Application_Start = Server.MapPath (" Users.xml "), and then call application (" Xmlpath ") in the Session_End, not directly in session_end such as: Server.MapPath (" Users.xml "),

Their order of execution is: 1:application_start 2:session_start; 3:session_end:4 Application_End

 

Summary of the start end method for ASP. Application and Session

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.