修改Web.Config里的值

public void Modify(string key, string value)

{

Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~");

AppSettingsSection appSettingsSection = (AppSettingsSection)configuration.GetSection("appSettings");

   if (appSettingsSection != null)

   {

       appSettingsSection.Settings[key].Value = value;

       config.Save();

   }

}

posted on 2010-04-22 14:00  冰危节奏  阅读(214)  评论(0编辑  收藏  举报

导航