Use the global.asax file

xiaoxiao2021-03-06  108

Author: Unknown Please click here to contact me

Global.asax file

In addition to writing the UI code, developers can also add the logic and event processing code of the application level to their web application. This code does not process the generation of the UI and is generally not called to respond to individual page requests. Instead, it is responsible for handling higher-level application events, such as Application_Start, Application_END, SESSION_START, SESSION_END, and more. Developers use the Global.asax files located at a specific web application virtual directory tree root to create this logic. When any resource or URL is activated or requested by the application namespace, ASP.NET automatically analyzes the file and compiles it into a dynamic .NET framework class (this class extends the httpApplication base class).

When you activate or request any resource or URL within the application namespace, ASP.NET analyzes the Global.asax file and dynamically compiles it into a .NET framework class. The global.asax file is configured to automatically reject any direct URL request, so that external users cannot download or view internal code.

Events within the application or session

The developer can define the handler for the event definition of the HTTPApplication base class by creating a method of changing the name mode "Application_EventName (ApproPriTeeventArgumentSignature" in the global.asax file. E.g:

C #: