Creating Understanding and Educating Programmers, Developers and Technical Communities, one post at a time.

Thursday, May 14, 2009


The Global.asax file(the ASP.NET application file) contains code for responding to application-level and session-level events raised by ASP.NET or by HTTP modules.

By default, the ASP.NET Framework maintains a pool of HttpApplication objects to service incoming page requests. A separate HttpApplication instance is assigned to each request.

If you prefer, you can create a custom HttpApplication class. That way, an instance of your custom class is assigned to each page request.

You can create custom properties in your derived class. These properties can be accessed from any page, control, or component. You also can handle any application events in your custom HttpApplication class.

You create a custom HttpApplication class by creating a special file named Global.asax in the root of your application. Following are few more detail about it.

  • It is optional file.
  • It must be located in the root directory. (file located in sub-directory is simply ignored)
  • Only one global.asax file per application. (you can not have more than one for an application.)

public class Global: System.Web.HttpApplication
//It is derived from HttpApplication base class

protected void Application_Start(Object sender, EventArgs e)
//lush(good) code

No comments:

Post a Comment