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對我來說。