New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

How to read Telerik appSettings from an external file

HOW TO

Load the Telerik appSettings flags from an external file.

DESCRIPTION

The UI for ASP.NET AJAX controls provide [a lot of switches and settings you can set from the appSettings section in the web.config](/devtools/aspnet-ajax/general-information/web-config-settings-overview#control-properties-you-can-set-from-the-webconfig. In some cases you may want to declutter the web.config file and read these settings from a separate file. This can even facilitate deployment and testing, especially if you also use your own flags in the appSettings section.

SOLUTION

ASP.NET allows you to import sections of the web.config file from an external file that is under the same folder. To do this:

  1. copy the appSettings section in your desired configuration file (e.g., in ~/App_Data/myAppSettings.config)
  2. remove the contents of the appSettings section
  3. set the configSource attribute of the appSettings tag to point to the external file (configSource="App_Data\myAppSettings.config"). Note the backslash that denotes a physical path.

You can find attached a small example below. Just add the Telerik assemblies to the ~/bin folder.

SEE ALSO

A sample project that demonstrates the approach can be found attached here:

load-appsettings-from-external-file.zip

In this article
Not finding the help you need? Improve this article