What is the difference between app.config, web.config and machine.config ?

 Posted by articlesmaint on 2/3/2011 | Category: .NET Framework Interview questions | Views: 38892

In this .NET Interview questions interviewer expects two things. First the importance of configuration and second in which scenarios are the above file applicable. So lets answer the question in two parts.

The importance of config files
App.config, web.config and machine.config are files which store configuration data in XML

format. We need configuration data at application level or at machine/server level.

Scenarios in which the above config files are used
Machine.config file stores configuration information at system level. It can contain configuration information like timeout in ASP.NET application, requestLimit, memoryLimit, and ClientConnectedCheck etc.

Generally we have two kinds of application web application and windows application. Web.config file stores configuration data for web applications and app.config file store configuration information for windows application.

Application level configuration data can be like connection strings,security etc.

Some connected questions from this question which the interviewer can ask
Where do you store connectionstring ?.
How do you encrypt connection string?
How do you read configuration data from web.config or app.config file in .NET ?
Can we have two web.config files for a web application.



Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response