using System; using System.Configuration; using System.Xml; namespace Common { public class ConfigHelper { public static string GetAppSettings(string key) { try { return ConfigurationManager.AppSettings[key].ToString().Trim(); } catch (Exception ex) { return ex.Message; } } public static void SetValue(XmlDocument xmlDocument, string selectPath, string key, string keyValue) { XmlNodeList xmlNodeList = xmlDocument.SelectNodes(selectPath); foreach (XmlNode xmlNode in xmlNodeList) { if (xmlNode.Attributes["key"].Value.ToUpper().Equals(key.ToUpper())) { xmlNode.Attributes["value"].Value = keyValue; break; } } } } }