public static void SetAppKey(string keyName, string keyValue)
{
Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(System.Web.HttpContext.Current.Request.ApplicationPath);
AppSettingsSection appSection = (AppSettingsSection)config.GetSection("appSettings");
if(appSection.Settings[keyName] != null)
appSection.Settings[keyName].Value = keyValue;
config.Save();
}