Protected Sub btnEncrypt_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnEncrypt.Click<br /> Dim config As System.Configuration.Configuration = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)<br /> Dim section As ConfigurationSection = config.GetSection("connectionStrings")<br /> If section IsNot Nothing AndAlso Not section.SectionInformation.IsProtected Then<br /> section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider")<br /> config.Save()<br /> End If<br /> End Sub<br /> Protected Sub btnDecrypt_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDecrypt.Click<br /> Dim config As System.Configuration.Configuration = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)<br /> Dim section As ConfigurationSection = config.GetSection("connectionStrings")<br /> If section IsNot Nothing AndAlso section.SectionInformation.IsProtected Then<br /> section.SectionInformation.UnprotectSection()<br /> config.Save()<br /> End If<br /> End Sub