【发布时间】:2011-06-04 09:36:42
【问题描述】:
这是我的 C# 代码:
System.Configuration.Configuration config =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/Web.config");
ConfigurationSection section = config.GetSection("appSettings");
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
section.SectionInformation.ForceSave = true;
config.Save(ConfigurationSaveMode.Modified);
string sectionXml = section.SectionInformation.GetRawXml();
我需要以编程方式加密web.config,但它给了我错误:
无法为请求的配置对象创建配置文件。
【问题讨论】:
-
这个错误发生在哪行??
-
config.Save(ConfigurationSaveMode.Modified);发生了
标签: c# asp.net web-config asp.net-4.0