public static void ProtectSection(String sSectionName)
 {
 // Open the app.config file.
 Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
 // Get the section in the file.
 ConfigurationSection section = config.GetSection(sSectionName);
 // If the section exists and the section is not readonly, then protect the section.
 if (section != null)
 {
 if (!section.IsReadOnly())
 {
 // Protect the section.
 section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
 section.SectionInformation.ForceSave = true;
 // Save the change.
 config.Save(ConfigurationSaveMode.Modified);
 }
 }

<span id="more-1109"></span>

Nenhum post foi relacionado a este