【发布时间】:2012-09-24 20:30:37
【问题描述】:
我想保护我的 appSettings 中的一个键/值对,而不是使用我之前使用 ProtectSection 方法完成的其他键/值对,如下所示。
var configurationSection = config.GetSection("appSettings");
configurationSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
理想情况下,我想做如下的事情:
var configurationElement = config.GetSection("appSettings").GetElement("Protected");
configurationElement.ElementInformation.ProtectElement("DataProtectionConfigurationProvider");
这是我将要操作的示例 appSettings:
<configuration>
<appSettings>
<add key="Unprotected" value="ChangeMeFreely" />
<add key="Protected" value="########"/>
</appSettings>
</configuration>
我一直在寻找,但还没有找到方法。这可能吗?
【问题讨论】:
标签: c# .net app-config