The difference between Web.config and App.config.

 

web.config is used with web application. web.config will by default have several configurations required for the web application. You can have a web.config for each folder under your web application.


app.config is used for windows applications. When you build the application in vs.net, it will be automatically renamed to <appname>.exe.config and this file has to be delivered along with your application.

You can use the same method to call the appsettings values from both config files :


System.Configuration.COnfigurationSettings.AppSettings["Key"]

 

If you make any changes to the web.config, web application will immediately load the changed config. But in case of <application name>.exe.config, you have to restart the application.

 

I am not very sure about whether any other difference is there in both. From the notes i read i found that


An app.config file is called "app.config" because it is the configuration file for an application, it cannot be used for a class library.
web.config is an ASP.Net app.config file.


Suppose for example you have a c# class library with app.config in your asp.net project with web.config then the project will refer only web.config as the project is an asp.net project though the project includes c# and app.config.

 

posted @ 2010-11-09 10:07  子夜.  Views(345)  Comments(0Edit  收藏  举报