Web.config file encryption is simple and people can easily use aspnet_regiis to encrypt / decrypt configuration file but when it comes to app.config based configuration files, aspnet_regiis is overlooked. Yes, we can use same aspnet_regiis for app.config file as well :)
Here are the steps:
- Rename app.config file to web.config :)
- Add following section on the very first line after <configuration> and save renamed web.config file
<protectedData>
<protectedDataSections>
<add name="appSettings"
provider="DataProtectionConfigurationProvider"
inheritedByChildren="false" />
</protectedDataSections>
</protectedData>
3. Locate aspnet_regiis.exe in c:\windows\microsoft.net\framework\v2.0.#####\ folder
4. Run following command from command line at c:\windows\microsoft.net\framework\v2.0.#####\:
> aspnet_regiis -pef "appSettings" <folder path where renamed Web.config is placed> -prov "DataProtectionConfigurationProvider"
5. After successful run, file will be encrypted
6. Rename web.config back to the original .config file
That’s it. I hope this helps!
81813e87-0eb7-406b-9995-d5545948ad4e|0|.0