Compartilhar via


Global.asax Syntax

The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level events raised by ASP.NET or by HTTP modules. The Global.asax file resides in the root directory of an ASP.NET application. At run time, Global.asax is parsed and compiled into a dynamically generated .NET Framework class derived from the HttpApplication base class. The Global.asax file itself is configured so that any direct URL request for it is automatically rejected; external users cannot download or view the code in it.

The Global.asax file is optional; if you do not define the file, the ASP.NET page framework assumes that you have not defined any application or session event handlers.

You can use the elements listed in the next section to compose a Global.asax file for your application. These elements can appear in any order and there can be as many of each type as you wish.

In This Section

ASP.NET Applications