0、先添加
<add key="MAXNUM" value="6" />
1、读取值
string maxNum = ConfigurationManager.AppSettings["MAXNUM"];
2、保存值
Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection appSettings = config.AppSettings;
appSettings.Settings["MAXNUM"].Value = nCount.ToString();
config.Save();