Getting Configuration Error after encrypting external appSetting.config file and trying to use it in other settings file

0

I am encrypting my config file so that client should not be able to read it when I deploy it on client side because it contains passwords.

For this purpose I have encrypted my ApplicationSettings.config file successfully but when I use it as :

  <appSettings configSource="ApplicationSettings.config" />

in any other file then I get the error when I run it and the error is:

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Failed to decrypt using provider 'AppEncryptionProvider'. Error message from the provider: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

Source Error: 


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" />

Source File: C:\inetpub\wwwroot\ApplicationSettings.config    Line: 2 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34009

However when I copy and paste my complete ApplicationSettings.config at appSettings section like this:

      <appSettings>

  <add key="key" value="3.0.0.0" />
  <add key="key2" value="value2" />


      </appSettings>

then it works fine.What is that I am missing?

How can I use ApplicationSettings.config file anywhere?

Or should I encrypt it some other way? for how I have encrypted please refer to..Can we encrypt external appSettings and connectionStrings in web.config?

Please tell me if I can provide more details.

asp.net
security
encryption
web-config
asked on Stack Overflow Nov 22, 2017 by amrit • edited Dec 28, 2017 by amrit

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0