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();
}