February 28, 2016

Read Key value from Sitecore config File

Lets see how can we read key value from config file.
string
dbName = Sitecore.Configuration.Settings.GetSetting("DB");

Your config file will contain content something like this.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">

  <sitecore>

    <settings>

      <setting name="DB" value="ITDetails"/>

    </settings>

  </sitecore>

</configuration>

No comments:

Post a Comment