AI OnAI Off
Global.EPConfig["keyname"]
and it gets the instance specific setting.
Thanks
Ben
Enter the following lines in web.config (inside the appSettings section):
Enter the following lines in an .aspx file:
<%# EPiServer.Global.EPConfig["EPfShowNewsOnFrontPage"].GetType().ToString() %>
<%# EPiServer.Global.EPConfig["ShowNewsOnFrontPage"].GetType().ToString() %>
You'll get the result:
System.Boolean
System.String
So, EPn (n for number), EPs (s for string) and EPf (f for flag) will be converted to the correct type for you automatically, you do not have to parse it yourself, you only have to cast it.
// This will never throw an nullreference or cast exception,
// even if the setting does not exists
bool showSomething = (bool)Global.EPConfig["EPfShowSomething"];
If a setting has not been defined in the web.config file, or there is a problem parsing the values, the default value will be used instead:
EPf: false
EPn: 0
EPs: string.Empty
So, the prefixes for all those EPiServer keys in web.config are there for a specific reason, not just for aesthetics. :-)
/Steve
section. EPiServer obviously reads some of the sites settings from here but when i add my own settings to this section asp.net just uses the default entry from the
section. How can i get the instance specific appSettings in my asp.net page? Thanks Ben Crinion