Usually connection string in web config is not encrypted. For security purpose in
asp.net 2.0 or upper version there is a functionality to encrtypt the connection
string. The .NET Framework have two protected configuration providers:
* RSAProtectedConfigurationProvider - uses the asymmetric RSA algorithm
for encryption and decryption.
* DPAPIProtectedConfigurationProvider - uses the Windows Data Protection
API (DPAPI) for encryption and decryption.
In this example we have made two methods for encryption and decryption and called
on buttons. In working example you just need to extract the example and open as
website and run. Changes will be seen in webconfig of example.
There are two main functions in example named:
1) ProtectSection
2) UnProtectSection
When you want to encrypt the connection string then call the first function and
when you want to check the original values of the connections then call second function.
This is attached example's screen. On first button's click you can encrypt the connection
string (app settings). After click on Encrypt Button you can check the effect on
string in web.config.
Click here to see the working example in video