Reading the settings of a site programatically
Versions:
5.1,
FAQ number:
195,
Old FAQ number: 13273
Question:
How do I read the settings of my site programatically?
Answeer:
In previous versions of EPiServer (EPiServer 4 and earlier), the EPiServer specific settings were located under the AppSettings block in the Web.Config file. These have now been removed.
Instead of using the AppSettings collection, EPiServer settings are today accessed through the use of a configuration class. All settings are typed members of this class, which gives the added benefit of being able to see all settings through IntelliSense.
Access to the site settings goes through the static object EPiServer.Configuration.Settings.Instance. There is no need to instantiate this class since it's a global static available throughout all of the application.
For example, to read the URL to the UI folder, you would write the following code:
String uiURL = Settings.Instance.UIUrl.ToString();
If you want to read non EPiServer CMS 5 settings in the AppSettings section you can use the .NET way, via System.Web.Configuration.WebConfigurationManager.AppSettings collection.
Also, see the topic "Read site Settings Programmatically" in the "How To" section of the