Difference between Global.asax & Web.config

Global.asax – Global.asax is a class file, holds the Global application class and its intrinsic methods (e.g. Application and Session Events etc.).This file is get compiled on the first page hit to your Web application. We need to compile/rebuild application if there is change in global.asax file. We can also store connection strings as Application-level variables from Application_Start in global.asax.

Web.Config – The web.config is an XML-formatted text file that resides in the Web site’s root directory. We don’t have to do compile/rebuild with web.config change (you only have to save the web.config file) to reflect the change. The web.config file specifies configuration data for the .NET application, like custom error pages, authentication and authorization settings for the Web site, compilation options for the ASP.NET Web pages, if tracing should be enabled, and etc.Commonly we put connection strings in web.config.


2 thoughts on “Difference between Global.asax & Web.config”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s