Можем ли мы зашифровать внешние настройки приложений и строки соединений в файле web.config?
Below web.config is used in MVC Web Application. I need to encrypt appSettings.config and connections.config which is external to web.config using configSource.
<?xml version="1.0"?>
<конфигурация xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
&ЛТ;параметр appsettings разделе configsource="параметр appsettings.конфигурация"/&ГТ;
&ЛТ;connectionstrings в разделе configsource="автобусов.конфигурация"/&ГТ;
&ЛТ;система.веб&ГТ;
<compilation debug="true" />
<режим аутентификации="Windows"/>
<identity impersonate="true"/>
Что я уже пробовал:
I tried to encrypt using RsaProtectedConfigurationProvider with aspnet_regiis. But it is not working as expected in simple Web.config where appSettings and connectionStrings present at the same file.
I am using below command to encrypt web.config C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pef "connectionStrings" "D:\WebApplication" -prov "AppEncryptionProvider". C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pef "appSettings" "D:\WebApplication" -prov "AppEncryptionProvider
but while using this in a web application it gives me the error as below: Failed to decrypt using provider 'AppEncryptionProvider'. Error message from the provider: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Line 1: <appSettings configProtectionProvider="AppEncryptionProvider"> Line 2: <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" Line 3: xmlns="http://www.w3.org/2001/04/xmlenc#"> Line 4: <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />