我只是通过这个代码读取web.config文件作为添加appSettings部分通过C#代码的web.config
Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection appSettingsSection = (AppSettingsSection)configuration.GetSection("appSettings");
if (appSettingsSection != null)
{
appSettingsSection.Settings.Remove(key);
config.Save();
}
它正常工作时appSettings
出现在web.config
文件。
我的查询是在web.config
文件中添加appSettings
标记如果它不存在。
通常您只需编辑配置文件。你为什么试图修改它有问题? –
@Jason Meckley它是我的作品 – GowthamanSS