Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

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

Application Directives
Specify optional settings used by the ASP.NET processor when handling ASP.NET files.
Code Declaration Blocks
Define member variables and methods to be compiled into the generated HttpApplication class.
Server-Side Object Tags
Declare and create new objects using a declarative, element-based syntax.
Server-Side Include Directives
Insert the raw contents of a specified file anywhere within the Global.asax file.

Related Sections

ASP.NET Applications

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.