1
私のC#アプリケーションで次のセクションを暗号化します。 NameValueCollection
はProtectSection
メソッドをサポートしていないためapp.configのカスタムセクションを暗号化します
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="ConX" type="System.Configuration.NameValueSectionHandler" />
</configSections>
<ConX>
<add key="SqlSrv" value="0.0.0.0"/>
</ConX>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
...
次のコードは、動作しません。
このセクションはどのように暗号化できますか?私は次の行をしようとすると、私はそれが動作の下に示し、その部分を見つけることができるように値を読めば
var section = ConfigurationManager.GetSection("ConX") as NameValueCollection;
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
は、セクションオブジェクトは、ちょうど、
AppSettingsSection section = ConfigurationManager.GetSection("ConX") as AppSettingsSection;
しかしヌルとどまります。