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.