What is the appSettings section in the web.config file?

Asked 07-Dec-2019
Viewed 678 times


What is the appSettings section in the web.config file

1 Answer


AppSettings section in the Web.config file

Web.config file defines configuration for a webproject.

AppSetting section is used to set the user defined values.

For e.g.: The ConnectionString which is used through out the project for database connection.


<appSettings><BR><addkey="ConnectionString"value="server=xyz;pwd=www;database=testing" />

And Other is - 

The AppSetting section in the configuration file is a section that allows us to keep configurable and application wide settings (For example : ConnectionString) that an application requires in order to perform the tasks properly. This helps in easy maintenance and deployment of the application.



    <add key="ConnectionString" value="(your connection string)" />

Code behind: 

string strConnection = ConfigurationSettings.AppSettings["ConnectionString"];