zoukankan      html  css  js  c++  java
  • 配置文件分组,获得权限访问页面

    <configuration>
      <configSections>
        <sectionGroup name="TestGroup">
          <section  name="admin"  type="System.Configuration.NameValueSectionHandler"></section>
          <section  name="customer"  type="System.Configuration.NameValueSectionHandler"></section>
          <section  name="test3"  type="System.Configuration.NameValueSectionHandler"></section>
        </sectionGroup>
      </configSections>
      <TestGroup>
        <admin>
          <add key="1" value="Main"></add>
          <add key="2" value="Coupon"></add>
          <add key="3" value="Tuan"></add>
          <add key="4" value="Product"></add>
          <add key="5" value="ProdPromotion"></add>
          <add key="6" value="PromotionList"></add>
          <add key="7" value="UpdatePwd"></add>
          <add key="8" value="UserCmsList"></add>
          <add key="9" value="CmsList"></add>
        </admin>
        <customer>
          <add key="1" value="Main"></add>
          <add key="2" value="Product"></add>
          <add key="3" value="ProdPromotion"></add>
          <add key="4" value="PromotionList"></add>
          
        </customer>
        <test3>
          <add key="user3" value="3"></add>
        </test3>
      </TestGroup>
    

     读取的时候

                NameValueCollection nc = (NameValueCollection)ConfigurationSettings.GetConfig("TestGroup/admin");
                foreach (var key in nc.AllKeys)
                {
                 value= nc[key].ToString() 
                }
    

     ConfigurationSettings.GetConfig("TestGroup/admin");//这个节点是大组下面的子类admin,

  • 相关阅读:
    杨辉三角
    手动实现md5加密
    戳气球
    重构字符串
    四数相加 II
    背包问题 II
    组合总和 IV
    背包问题 V
    背包问题
    Win 10安装Python及环境变量配置
  • 原文地址:https://www.cnblogs.com/gylspx/p/ssss.html
Copyright © 2011-2022 走看看