How To: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI

These How To show how to use the Windows Data Protection application programming interface (DPAPI) protected configuration provider, the RSA Protected Configuration provider and the Aspnet_regiis.exe tool to encrypt sections of your configuration files. Aspnet_regiis.exe tool can be used to encrypt sensitive data, such as password, held in the Web.config.

The DPAPI protected configuration provider supports machine-level and user-level stores for key storage. The choice of store depends largely on whether or not your application shares a server with other applications and whether or not sensitive data must be kept private for each application. Note that if your application is deployed in a Web farm, you should use the RSA protected configuration provider due to the ease with which RSA keys can be exported.

Refer to the following links for a full description:
  1. http://msdn.microsoft.com/en-us/library/ms998280.aspx
  2. http://msdn.microsoft.com/en-us/library/ms998283.aspx