New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
How to read Telerik appSettings from an external file
Updated over 6 months ago
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. 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:
- copy the
appSettingssection in your desired configuration file (e.g., in ~/App_Data/myAppSettings.config) - remove the contents of the
appSettingssection - set the
configSourceattribute of theappSettingstag 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
- MSDN: Using External Configuration Files
- How to encrypt the Telerik appSettings keys
- Telerik Control Properties You Can Set From the web.config
A sample project that demonstrates the approach can be found attached here: