我想加密common.config,而不是Web.config文件。 Common.config与web.config位于不同的位置。 web.config文件连接到common.config。如何加密.config文件Asp.net
的web.config:
<appSettings file="C:\Users\ja\Documents\common.config">
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
common.config:
<appSettings>
<add key="myKey" value="This is the Value"/>
</appSettings>`
这适用于web.config文件:
aspnet_regiis.exe -pef appSettings c:\Users\ja\Desktop\test\webapp\webapp -prov "RsaRpotectedConfigurationProvider"
但是,当我试图加密常用.config文件:
aspnet_regiis.exe -pef appSettings c:\Users\ja\Document\ -prov "RsaRpotectedConfigurationProvider"
我得到这个错误:
The configuration for physical path 'c:\Users\ja\Document\' cannot be opened
不行,它仍然不起作用。 – User765876
它看起来像路径参数应该指向一个Web应用程序。也许将common.config移动到应用程序的根目录而不是Documents文件夹? – David
也不起作用。 – User765876