Web.Config: Encrypt Configuration Section programatically:
Configuration config = Configuration.GetWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.Sections[“ConnectionStrings”];
section.ProtectSection(“DataProtectionConfigurationProvider”);
config.Update();
Alternate Code:
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection(‘sectionNameHere’);
if(section != null && !section.SectionInformation.IsProtected)
{
section.SectionInformation.ProtectSection(‘providerName’);
config.Save();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment