All the settings of the Sitecore are stored in the config files. Sitecore consists of web.config which stores all the configuration information. Addition to this Sitecore has many config files which are stored in the App_Config/Include folder. Most of the time’s developer place the config files to override or patch the Sitecore functionalities. So how do you Access Sitecore settings Programmatically which is present in the config file?
Access Sitecore settings Programmatically
During the runtime, Sitecore combines all these config files into one single web.config file. Hence at the runtime, we can access any of these config file settings programmatically.
To verify the web.config file Sitecore provides an admin page.
URL : http://myurl/sitecore/admin/showconfig.aspx
The above URL will combine all the configs from App_Config/Include and displays single config file.
All the settings listed in the config file can be accessed at run time using the below code.
Access Data Folder in Sitecore Programmatically
string dataFolder = Sitecore.Configuration.Settings.DataFolder;