Configurable Parameters for ASP.Net Applications

The easiest way to create a set of configurable parameters for an ASP.Net application is to add them to the web.config file.  The web.config file is just an XML file that holds a bunch of parameters for ASP.Net itself as well as application specific parameters.


To add application specific parameters to web.config you need to add an <appSettings> section if one doesn’t already exist.  Then add an <add key=”" value=”" /> element for each parameter that you wish to add.  Key is the name of the parameter and value is its value.  To retrieve that value of a parameter in your application use the ConfigurationManager.AppSettings property.









    <add key=”DllURL” value=”http://localhost:81/cgibin/web.dll” />






  String url = ConfigurationManager.AppSettings[”DllURL”];



Comments are closed.