Different applications such as a web site, schedulers for periodic actions, or its sub site may use same set of app keys, and these apps may not be hosted in the same web domain. For instance, there may have a common email turn off/on feature or directory path that is shared for different apps. Then we can create a common.config file and add the keys there. Finally we can re-use this file form different app using “File” attribute of configuration file, not “ConfigSource” attribute. It uses a relative path to an external file that contains custom application configuration settings. Please visit the link how to use it.




A couple months ago, we used this approach on our application, and it helps enough. Our practical experience is that web site will not restart after changing the appSettings.config file unlike changing appsettings in the web.config file, and thus, your new keys will not be applied unit you restart your web app.

Add new comment