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

Source: Internet
Author: User

You can process two types of events in the global. asax file.

1. events that occur for each request, including requests and responses

2. events that occur only under certain conditions.

1. Request and response related events

1. applcation_beginrequest (): This method is called at the beginning of each request;

2. application_authenticaterequest (): This method is called before authorization confirmation is executed. This is the starting point for creating your own authorization logic.

3. application_authorizerequest (): determines the user's operation permission after the user's access identity is confirmed. You can use this method to assign special permissions to users.

4. applcation_resolverrequestcache (): This method is usually used in combination with the output cache. Using this cache mechanism, HTML of the transformed web form can be reused without executing any code. However, the event processor is still running.

5. At this time point, the processed request leaves the corresponding event processor. For example, for a web form request, when the webpage is compiled (if needed) and instantiated.

6. application_acquirerequeststate (): This method is called before obtaining and setting specific session information of the client.

7. application_prerequesthandlerexecute (): This method is called before the corresponding HTTP processor executes the request.

8. At this point in time, the corresponding processor executes the request. For example, if it is a web form request, the webpage Event code will be executed and the webpage will be converted to HTML.

9. application_postrequesthandlerexecute (): This method is called after the request is processed.

10. application_releaserequeststate (): This method is called when the specific information in the session (Session) is serialized so that the information is valid in the next request.

11. application_updaterequestcache (): This method is called before the information is added to the cache. For example, if you output a web page to the cache, ASP. NET inserts the converted HTML page into the cache at this time point.

12. application_endrequest (): This method is called before the object is released and recycled after the request ends. This is an appropriate starting point for clearing the code.

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.