Settings designer file complains when protecting configuration for connectionStrings in App.Config i
Posted
by Joe
on Stack Overflow
See other posts from Stack Overflow
or by Joe
Published on 2010-05-27T07:58:32Z
Indexed on
2010/05/27
8:01 UTC
Read the original article
Hit count: 242
Hi,
I am trying to encrypt Configuration Information Using Protected Configuration in Visual Studio 2010.
I have the following info speicifed in the App.Config file:
<connectionStrings configProtectionProvider="TheProviderName">
<EncryptedData>
<CipherData>
<CipherValue>VALUE GOES HERE</CipherValue>
</CipherData>
</EncryptedData>
</connectionStrings>
<appSettings configProtectionProvider="TheProviderName">
<EncryptedData>
<CipherData>
<CipherValue>VALUE GOES HERE</CipherValue>
</CipherData>
</EncryptedData> </appSettings>
However, when I then go to the Settings area of the Projects Properties to view the settings in the Designer, I get prompted with the following error "An error occured while reading the App.config file. The file might be corrupted or contain invalid XML." I understand that my changes are causing the error, however, is there anyway I can bypass that the information is not read into at design view? (Of course the best way would be to make the tags be recognized by the designer, is there any way to do this?) I tried adding
<connectionStrings configProtectionProvider="TheProviderName" xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
to connectionStrings as well as to the appSettings, but with no luck, the intellisense is bypassed in the config file, but the designer still complains. I would be satisfied if the designer would not complain about this "error", which is not actually an error because Microsoft states here that it should work.
ASP.NET 2.0 provides a new feature, called protected configuration, that enables you to encrypt sensitive information in a configuration file. Although primarily designed for ASP.NET, protected configuration can also be used to encrypt configuration file sections in Windows applications. For a detailed description of the new protected configuration capabilities, see Encrypting Configuration Information Using Protected Configuration.
And yes, it does work to encrypt it and to decrypt it and use it, it is just very annoying and frustrating that the designer complains about it. Anyone who knows which xsd file that is used (if used) to verify the contents of the App.config file in the design view?
Any help appreciated.
© Stack Overflow or respective owner