Hi guys,
I'm encrypting the appsettings section at runtime for changes that are made to the application
First if check if the section is encrypted, and if not, i then encrypt it with the below code:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConfigurationSection confsection = config.GetSection(section) as ConfigurationSection;
if (!confsection.SectionInformation.IsProtected)
{
isEncrypted = false;
//confsection.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
confsection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
confsection.SectionInformation.ForceSave = true;
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.Refres ...
Go to the complete details ...