给config加密

Configuration config = WebConfigurationManager.OpenWebConfiguration("/");

            ConfigurationSection appSettings = config.GetSection("appSettings");

            if (appSettings.SectionInformation.IsProtected)

            {

                appSettings.SectionInformation.UnprotectSection();

            }

            else

            {

                appSettings.SectionInformation.ProtectSection(

                "DataProtectionConfigurationProvider");

            }

            config.Save();

 

你可能感兴趣的:(config)