Global.asax

Post date: Mar 1, 2011 6:49:52 AM

The Global.asax file is parsed and dynamically compiled by ASP.NET. You can deploy this file as an assembly in the \bin directory of an ASP.NET application. 

How to create Global.asax

Adding a Global.asax to your web project is quiet simple.

 

Open Visual Studio 2005 or 2008 > Create a new website > Go to the Solution Explorer > Add New Item > Global Application Class > Add.

 

Examining the methods related to the events in Global.asax

 

There are 2 ‘set’ of methods that fire corresponding to the events. The first set which gets invoked on each request and the second set which does not get invoked on each request.

Let us explore these methods.

 

Methods corresponding to events that fire on each request

Methods corresponding to events that do not fire on each request

Conclusion:

In this article, we learnt that Global.asax is a file used to declare application-level events and objects. The file is responsible for handling higher-level application events such as Application_Start, Application_End, Session_Start, Session_End, and so on. I would encourage you to explore the methods corresponding to the events and analyze the best possible methods to use them in your application, if needed.

I hope you liked the article and I thank you for viewing it.