What is the purpose of this asax extension?
I believe it is only used for the file Global.asax
and this file as stated in this SOen response aims to write a code that "responds" to the "application core" through certain events, such as when your application starts, ends or when a session starts and ends, it is possible to detect unhandled errors in the application.
Why does it have a different syntax?
I think it's because it's not an ASP.NET page, but an event handler, which occurs at the core of the application.
Only the Global.asax
file has this extension generally, or can others also have this extension?
I believe that other files with this extension are "rejected" if you try to execute them in your application (or perhaps in the request), each extension has a meaning:
-
S er P age and I believe that "X" is "extended"
-
A S erver A pplication and "X" may be "extended" / li>
Global.asax Events
And as per this response of SOen each event has a specific functionality
-
.aspx
: This is triggered when an ASP.NET application is initialized for the first time.
-
.asax
: It is fired when an application is destroyed.
-
Application_Init
: Is triggered when an unhandled exception occurs.
-
Application_Disposed
: Is triggered when the first instance of Application_Error
is created. This allows you to create objects that are accessible in all Application_Start
instances.
-
HttpApplication
: It is fired when the last instance of HttpApplication
is destroyed. This only fires during the application's "life cycle".
-
Application_End
: Fires when an application receives an HTTP request.
-
HttpApplication
: Last event to be triggered for a request.
-
Application_BeginRequest
: It is triggered before a page using the ASP.NET framework starts running the event handler for a page or a web service.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Application_EndRequest
: Is triggered when asp.net completes an authorization request. It allows cache modules to meet the cache request, ignoring the execution of the handler.
-
Application_PreRequestHandlerExecute
: Is triggered when ASP.NET completes the execution handler to allow caching modules to store responses to be used to handle subsequent requests.
-
Application_PostRequestHandlerExecute
: This is triggered when the security module established the current user's identity as valid. At this point, the user credentials have been validated.
-
Applcation_PreSendRequestHeaders
: Is triggered when the security module has verified that a user can access resources.
-
Application_PreSendContent
: It is fired 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.
-
Application_AcquireRequestState
: Is triggered when a user session is terminated or expires.
If you have any wrong information please notify me, I did not know more than half of these events myself