Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 19-03-2009
Member
 
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
Reply With Quote
  #2  
Old 19-03-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
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.
Reply With Quote
  #3  
Old 19-03-2009
Member
 
Join Date: May 2008
Posts: 2,293
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.
Reply With Quote
  #4  
Old 19-03-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Global.asax in ASP.Net"
Thread Thread Starter Forum Replies Last Post
What is global outsourcing? Megatruck Education Career and Job Discussions 5 18-11-2010 02:48 PM
Global.mpt CreepeRer Microsoft Project 4 29-04-2010 06:53 PM
Is Global synchronization possible TechGate Software Development 5 16-01-2010 01:09 PM
What is Global Variable static? Declaring static variable instead of Global variable Reckon Software Development 3 25-04-2009 11:34 AM
Global Catalog not Found Ranchero Active Directory 7 28-05-2008 06:06 PM


All times are GMT +5.5. The time now is 01:38 PM.