zoukankan      html  css  js  c++  java
  • app.config ConfigSection 保护

     public void ProtectSection(string sectionName)
           {
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            ConfigurationSection protectedSection= config.GetSection(sectionName);

            // Encrypts when possible
            if ((protectedSection!=null) && (!protectedSection.IsReadOnly()) && (! protectedSection.SectionInformation.IsProtected)
            && (!protectedSection.SectionInformation.IsLocked) && (protectedSection.SectionInformation.IsDeclared))
            {
                // Protect (encrypt)the section.
                protectedSection.SectionInformation.ProtectSection(null);
               // ' Save the encrypted section.
                protectedSection.SectionInformation.ForceSave =true;
                config.Save(ConfigurationSaveMode.Full);
            }
            
           }
  • 相关阅读:
    字体
    当前li的同级且不包含当前li
    溢出用省略号显示
    .NET Core中使用Cookie步骤
    .NET Core中使用Session步骤
    asp.net core 读取配置
    Asp.Net Core run on Ubuntu
    .net core中使用GB2312编码
    ubuntu mysql 安装
    samba的安装
  • 原文地址:https://www.cnblogs.com/tianya/p/2203487.html
Copyright © 2011-2022 走看看