Protect Your Config Settings

Here is a basic Sitecore tip, but I think a good one.  If you ever have a need to place a setting in the web.config Sitecore has a great tool to introduce a fallback in case your setting ever gets accidentally removed.

Take for example:

Now with the class Sitecore.Configurations.Setting.GetSetting we can add a default into our data layer.

return Sitecore.Configuration.Settings.GetSetting(“MySetting”, “This setting is NOT cool!”);

Now we have a fallback just in case something goes wrong.  Of course if this setting is something real important like a service call or a currency standard I would advise going an extra step and extending this to something that has error checking.  And in the case of some instances, maybe its better that the page calling this setting errors out anyways.  But in short, now you have a tool to default your settings where needed!

Tags: Sitecore;