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,

  • 相关阅读:
    DFS复习
    二叉搜索树专题
    二叉树路径问题
    二叉树LCA--leetcode236题
    二叉树创建与前、中、后序遍历
    leetCode--n数之和--哈希表/双指针
    leetCode--单词接龙--BFS
    vue-router简单实现
    Promise的简单实现
    闭包&作用域链&let
  • 原文地址:https://www.cnblogs.com/gylspx/p/ssss.html
Copyright © 2011-2022 走看看