Encrypting Sections Programmatically
Instead of using the
aspnet_regiis tool to encrypt configuration sections, you can use the Configuration API. Specifically, you can encrypt a configuration section by calling the
For example, the ASP.NET page in Listing 34.26 displays all the sections contained in the
system.web section group in a
GridView control. You can click Protect to encrypt a section and UnProtect to decrypt a section (see Figure 34.14).
Figure 34.14. Encrypting and decrypting configuration sections.
When you click the
Protect link, the