修改web.config中的键值
.cs file
{
//Get the configuration information for this web application.
Configuration config =
WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
//Make the change.
config.AppSettings.Settings["somekey"].Value = " some value";
//Save all the changes you've made since retrieving the configuration
//infomation.
config.Save()
}
web.config
{
<configuration>
<appSettings>
<add key="somekey" value="some v value"/>
</appSettings>
<system.web>
<!-- Configuration settings go here -->
</system.web>
</configuration>
}