Results 1 to 4 of 4

Thread: Global.asax in ASP.Net

  1. #1
    Join Date
    Nov 2008
    Posts
    85

    Global.asax in ASP.Net

    I am having a smallquery in ASP.net. I am new to this prgramming language and just wanted to know that what are the functions performed by the global.asax element in asp.net. Is it been used for handling and declaring application.

    Please provide some details regarding this

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Global.asax in ASP.Net

    Global.asax is an optional file used to declare and handle application- and session-level events and objects. Global.asax is the ASP.NET extension of the ASP Global.asa file. The Global.asax file resides in the IIS virtual root of an ASP.NET application. At run time, upon the arrival of the first request, Global.asax is parsed and compiled into a dynamically generated .NET Framework class. ASP.NET is configured so that any direct request for the Global.asax is automatically rejected, external users cannot view or download the code in it.

    Code to handle application events (such as the start and end of an application) resides in Global.asax. Such event code cannot reside in the ASP.NET page or web service code itself, since during the start or end of the application, its code has not yet been loaded (or unloaded). Global.asax is also used to declare data that is available across different application requests or across different browser sessions. This process is known as application and session state management.

    The Global.asax file must reside in the IIS virtual root. Remember that a virtual root can be thought of as the container of a web application. Events and state specified in the global file are then applied to all resources housed within the web application. If, for example, Global.asax defines a state application variable, all .aspx files within the virtual root will be able to access the variable.

    The ASP.NET Global.asax file can coexist with the ASP Global.asa file. You can create a Global.asax file either in a WYSIWYG designer or as a compiled class that you deploy in your application's \Bin directory as an assembly. However, in the latter case, you still need a Global.asax file that refers to the assembly.

    Like an ASP.NET page, the Global.asax file is compiled upon the arrival of the first request for any resource in the application. The similarity continues when changes are made to the Global.asax file: ASP.NET automatically notices the changes, recompiles the file, and directs all new requests to the newest compilation.

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: Global.asax in ASP.Net

    The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level and session-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. ASP.NET is configured so that any direct URL request for the Global.asax file is automatically rejected; external users cannot download or view the code in it.

    The Global.asax file is optional. You create it only if you want to handle application or session events.

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Global.asax in ASP.Net

    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 HttpModules. The Global.asax file resides in the root directory of an ASP.NET-based 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 written within it.

    The ASP.NET Global.asax file can coexist with the ASP Global.asax file. You can create a Global.asax file either in a WYSIWYG designer, in Notepad, or as a compiled class that you deploy in your application's \Bin directory as an assembly. However, in the latter case, you still need a Global.asax file that refers to the assembly.

    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.

    When you save changes to an active Global.asax file, the ASP.NET page framework detects that the file has been changed. It completes all current requests for the application, sends the Application_OnEnd event to any listeners, and restarts the application domain. In effect, this reboots the application, closing all browser sessions and flushing all state information. When the next incoming request from a browser arrives, the ASP.NET page framework reparses and recompiles the Global.asax file and raises the Application_OnStart event.

Similar Threads

  1. What is global outsourcing?
    By Megatruck in forum Education Career and Job Discussions
    Replies: 5
    Last Post: 18-11-2010, 02:48 PM
  2. Global.mpt
    By CreepeRer in forum Microsoft Project
    Replies: 4
    Last Post: 29-04-2010, 06:53 PM
  3. Is Global synchronization possible
    By TechGate in forum Software Development
    Replies: 5
    Last Post: 16-01-2010, 01:09 PM
  4. Replies: 3
    Last Post: 25-04-2009, 11:34 AM
  5. Global Catalog not Found
    By Ranchero in forum Active Directory
    Replies: 7
    Last Post: 28-05-2008, 06:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,148,914.14387 seconds with 17 queries