Application, server, and Session Object

Source: Internet
Author: User

Introduction to the Global. asax File

 

• Stored in applicationsProgramIn the root directory

• Define application boundaries

• Initialize application-level or session-level variables

• Connect to the database

• Send cookie

Global. asax event

Event

Trigger time

Application_onstart This is triggered when the first ASP. NET page of the current application directory (or its subdirectory) is called.
Application_onend Triggered when the last session of the application ends. In addition, it is triggered when you use the Internet Service Manager Management Unit to stop web applications.
Application_onbeginrequest It is triggered at the beginning of each page request (theoretically, when the page is loaded or refreshed.
Application_onendrequest It is triggered at the end of each page request (that is, every time the page is executed in the browser.
Session_onstart It is triggered at the beginning of each new session.
Session_onend It is triggered at the end of the session. (For more information about how to end a session, see session object ).

Httpapplication class

• Define methods, attributes, and events common to all application objects in ASP. NET Applications

• This class is the base class of the application defined by the user in the global. asax file.

• Such instances are created in the ASP. NET infrastructure, rather than directly created by users.

• An instance is used to process multiple requests within its lifetime, but it can only process one request at a time.

Httpapplicationstate class and application instance

• The httpapplicationstate class enables global information sharing between multiple sessions and requests in ASP. NET Applications

• The Application Object obtains the current state of the application.

• The application object can be obtained through attributes of the httpapplication class or page class.

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.