::raises hand:: I do this on my site -- you can also encrypt sql connections! (REALLY GOOD IDEA)
create a button and make this its event
protected void Button1_Click(object sender, EventArgs e)
{
ProtectSection("connectionStrings", "DataProtectionConfigurationProvider");
}
to unencrypt...
protected void Button2_Click(object sender, EventArgs e)
{
UnprotectSection("connectionStrings");
}
functions are the same as given on the link above (for fun, I pasted them below), and don't forget to add System.Web.Configuration
private void ProtectSection(string sectionName, string provider)
{
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection(sectionName);
if (section != null && !section.SectionInformation.IsProtected)
{
section.SectionInformation.ProtectSection(provider);
config.Save();
}
}
private void UnprotectSection(string sectionName)
{
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection(sectionName);
if (section != null && section.SectionInformation.IsProtected)
{
section.SectionInformation.UnprotectSection();
config.Save();
}
}
RileyTech.netTrainer video maker guy
"Where did you find that?" code man
Yes, I have and frequently wear a fedora :-P