I'm trying to get this given node value from the Sitecore configuration (Sitecore 9 instance).

My first approach was to read the configuration file on which this value is defined. Pretty standard...

The issue is that I just realized that a customer can add another configuration file to patch this value, what would make my first approach return a wrong value.

What is the best way of reading the final computed Sitecore configuration (what we see in the /showconfig.aspx)?

1 Answer 1


After struggling with this for a while, finally found the answers.

If what you are trying to read is really a setting following the below format:

<setting name="THE_NAME_GOES_HERE" value="THE_VALUE_GOES_HERE" />

You can use the Sitecore.Configuration.Settings.GetSetting(p_Name, p_DefaultValue) method to read it.

However, if what you are trying to read a Sitecore config node, the above method won't work.

In this case, you should aim to use the Factory.GetConfigNode(p_XmlPath) method and then grab the node's value.

  • 2
    If you want a real mindbender, checkout the SettingsSwitcher which allows you to create a context that sets a value for a specific setting, regardless of the value in the config. Commented Mar 21, 2019 at 19:08
  • TIL that Pete, thanks a lot! Commented Mar 21, 2019 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.