Application Event in the global. asax file of ASP. NET (2)

Source: Internet
Author: User

Not all requests are triggered.

1. application_start (): This method is called when the application is started for the first time and the application domain is created. It is very suitable to put the initialization I code within the application scope in this event processor. For example, you can load and cache data that does not change throughout the lifecycle of an application, such as static product directories in the navigation tree.

2. session_start (): This method is called when a new session starts. This is often used to initialize specific user information.

3. application_error (): This method is called when an unhandled exception occurs in the application.

4. session_end (): This method is called when a user's session ends. When the Code explicitly releases a session or times out because it has not received a customer's request for a long time, a session ends. In this case, you can use this method to clean up any related data.

5. application_end (): This method is called before the application ends.

6. application_disposed (): This method is called when the application is closed and the. NET garbage collector will recycle the memory occupied by the application. Although it is too late to clean up key resources, you can use it to perform the final cleaning to ensure that key resources are released.

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.