1
我有我的web.config中的自定义部分我需要加密。这个自定义配置部分使用configSource
属性指向一个单独的配置文件(因为这个文件不是源控制的),我希望这个单独的配置文件被加密。我没有运气使用aspnet_regiis.exe
加密本节。是否可以从web.config加密指定为configSource的配置文件?
是我想要实现的可能吗?
我的web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="protectedAppSettings" type="System.Configuration.NameValueSectionHandler, System,Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<protectedAppSettings configSource="config\EnvironmentConfigurations\ProtectedAppSettings.config" />
</configuration>
我的自定义配置文件:
<?xml version="1.0" encoding="utf-8"?>
<protectedAppSettings>
<add key="XXX" value="xxx"/>
</protectedAppSettings>
我添加ASPNET_REGIIS到我的道路,所以我可以从我的网站的根目录调用它。这是我执行命令:
aspnet_regiis -pef protectedAppSettings ""
我从这个命令得到的输出告诉我,加密成功
我发现this link,指出它应该只是工作但它不't对我来说。