写入Web.Config中AppSettings的方法
#region 写入Web.Config的AppSettings
/// <summary>
/// 写入Web.Config的AppSettings
/// </summary>
/// <param name="key">键值</param>
/// <param name="value">写入的值</param>
private static void WriteConfig(string key, string value)
{
Configuration MyConfig = WebConfigurationManager.OpenWebConfiguration("~");
MyConfig.AppSettings.Settings.Remove(key);
MyConfig.AppSettings.Settings.Add(key, value);
MyConfig.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
}
#endregion