How to get values from app settings section

Posted by Niladri.Biswas under C# category on | Points: 40 | Views : 680
Suppose we have

<add key="RuleMaster" value="DataSource\RuleMaster.xml"/>

To get the value from "RuleMaster", let us write the below code

 public string GetSettingValue(string configKey)
return System.Configuration.ConfigurationManager.AppSettings[configKey].ToString();
catch (Exception ex)
return string.Empty;

Use it : GetSettingValue("RuleMaster");

Comments or Responses

Login to post response