When building a website you will inevitably need to store configuration data somewhere. In today’s post, I’m going to cover the options available to you when you use Sitecore.

Web.Config

As Sitecore is a .NET application you can always use the app settings section in your web.config.

<appSettings>
<add key="SettingName" value="true" />
</appSettings>

Which you can then access in code like this:

var value = ConfigurationManager.AppSettings["SettingName"];

It’s generally advised to try and keep your web.config as mean and lean as possible. If you want to upgrade your Sitecore, then you have to merge manually your web.config.

SiteCore Setting

Sitecore also provides an easy API to write your own APP settings file. This can be really useful if you want to deploy your site in different environments. To create your own Sitecore App settings file, first, create a new file in \App_Config\Include. You can call it whatever you like. I normally use ProjectName.Settings.config.

In the file you can add in custom settings by using the following convention:

If you have any issue with your settings, you can always check Make sure the Sitecore config page to make sure Sitecore knows about your setting. To access use the following in your web browser, www.website.com/sitecore/admin/showconfig.aspx.

If you want to you can also use the Sitecore API to get access to normal App settings by using the following snippet:

Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge

SITECORE DEVELOPER?

Connect

Hi, I'm Jon, I write articles about creating and optimizing websites as well as making money from your online business. I am technical architect and technology fanatic by profession. You can find out more about me by signing up to my newsletter.