What is the purpose of this asax extension?
I believe it’s only used for the archive Global.asax
and this file as stated in this reply from Soen is intended to write a code that "responds" to the "core of the application" through certain events, such as when your application starts, ends, or when a session starts and ends, otherwise it is possible to detect manipulated errors in the application.
Why does it have a different syntax?
I believe it is because it is not an Asp.net page but an event handler, which occurs at the core of the application.
Only the file Global.asax
has this extension generally, or others may also have this extension?
I believe other files with this extension are "rejected" if you try to run them in your application (or maybe in the request), each extension has a meaning:
.aspx
- Toctive Sobserve Pacts and I believe the "X" is from "Extended"
.asax
- Toctive Sobserve Topplication and the "X" might be from "Extended"
Events of Global.asax
And according to this reply Soen each event has a specific functionality
Application_Init
: It is triggered when an ASP.NET application is first initialized.
Application_Disposed
: It is fired when an application is destroyed.
Application_Error
: It is triggered when an untreated Exception occurs.
Application_Start
: It is triggered when the first instance of HttpApplication
is created. This allows creating objects that are accessible in all instances HttpApplication
.
Application_End
: It is triggered when the last instance of HttpApplication
is destroyed. This only fired during the "life cycle" of the application.
Application_BeginRequest
: It is triggered when an application receives an HTTP request.
Application_EndRequest
: Last event to be triggered for a request.
Application_PreRequestHandlerExecute
: It is fired before a page using the ASP.NET framework starts running the event handler for a page or web service.
Application_PostRequestHandlerExecute
: It is triggered when a page with Asp.net framework finishes executing a handler event (Handler)
Applcation_PreSendRequestHeaders
: It is fired before a page that uses Asp.net sends the HTTP headers to whom it has requested (usually the browser).
Application_PreSendContent
: It is fired before Asp.net sends the content (body/body) to whom you requested it (browser/client).
Application_AcquireRequestState
: It is triggered when Asp.net picks up the current state (Session state) of the current request.
Application_ReleaseRequestState
: It is triggered when Asp.net completes the execution of all events.
Application_ResolveRequestCache
: It is triggered when Asp.net completes an authorization request. It allows cache modules to meet the cache request, ignoring the handler execution.
Application_UpdateRequestCache
: It is triggered when ASP.NET completes the manipulator run to allow cache modules to store responses to be used to handle subsequent requests.
Application_AuthenticateRequest
: It is triggered when the security module has established the current user’s identity as valid. At this point, the user’s credentials have been validated.
Application_AuthorizeRequest
: It fires when the security module has verified that a user can access resources.
Session_Start
: It is triggered when a new session is created and accessed for the first time. This event is usually used when we want to initialize some session logic.
Session_End
: It is triggered when a user session is finished or is expired.
If you have any wrong information please notify me, I myself was unaware more than half of these events