加密配置节

 protected void Button1_Click(object sender, EventArgs e) { Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); ConfigurationSection appSettings = config.GetSection("connectionStrings"); if (appSettings.SectionInformation.IsProtected) { appSettings.SectionInformation.UnprotectSection(); lblInfo.Text = "配置节已解密!"; } else { appSettings.SectionInformation.ProtectSection( "DataProtectionConfigurationProvider"); Button1.Text = "解密"; lblInfo.Text = "已加密配置节!"; } config.Save(); } 

你可能感兴趣的:(加密,object,解密,button)