我想保护我的appSettings中的一个键/值对,但不使用像我之前用ProtectSection方法完成的操作,如下所示。是否可以保护appSettings部分中的单个元素而不是整个部分?
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>
我一直在寻找,但避风港没有找到办法做到这一点。这可能吗?