system.web section group下的section

复制代码
  private Configuration _configuration;
        private ConfigurationSectionGroupCollection sectionGroups;
        private SystemWebSectionGroup systemWebSectionGroup;

        [SetUp]
        public void TestSetUp()
        {
            var filePath = @"/";
            _configuration = WebConfigurationManager.OpenWebConfiguration(filePath, "Test");
            sectionGroups = _configuration.SectionGroups;
            systemWebSectionGroup= sectionGroups.Get("system.web") as SystemWebSectionGroup;
        }

        [TearDown]
        public void TestTearDown()
        {
            _configuration = null;
        }
复制代码

 

默认有38个section

1 System.Web.Configuration.SecurityPolicySection
2 System.Web.Configuration.AuthenticationSection
3 System.Web.Configuration.ProfileSection
4 System.Web.Configuration.AuthorizationSection
5 System.Web.Configuration.MembershipSection
6 System.Web.Configuration.AnonymousIdentificationSection
7 System.Web.Configuration.HttpCookiesSection
8 System.Web.Configuration.PagesSection
9 System.Web.UI.MobileControls.MobileControlsSection
10 System.Configuration.DefaultSection
11 System.Web.Mobile.DeviceFiltersSection
12 System.Web.Configuration.MachineKeySection
13 System.Web.Configuration.WebPartsSection
14 System.Web.Configuration.WebControlsSection
15 System.Web.Configuration.CompilationSection
16 System.Web.Configuration.HealthMonitoringSection
17 System.Web.Configuration.TraceSection
18 System.Web.Configuration.ProcessModelSection
19 System.Web.Configuration.HttpRuntimeSection
20 System.Web.Configuration.CustomErrorsSection
21 System.Web.Configuration.IdentitySection
22 System.Web.Services.Configuration.WebServicesSection
23 System.Web.Configuration.SessionPageStateSection
24 System.Web.Configuration.UrlMappingsSection
25 System.Web.Configuration.TrustSection
26 System.Web.Configuration.SessionStateSection
27 System.Web.Configuration.ClientTargetSection
28 System.Web.Configuration.HttpModulesSection
29 System.Web.Configuration.FullTrustAssembliesSection
30 System.Web.Configuration.XhtmlConformanceSection
31 System.Web.Configuration.DeploymentSection
32 System.Web.Configuration.HttpHandlersSection
33 System.Web.Configuration.HostingEnvironmentSection
34 System.Web.Configuration.PartialTrustVisibleAssembliesSection
35 System.Web.Configuration.GlobalizationSection
36 System.Web.Configuration.RoleManagerSection
37 System.Web.Configuration.SiteMapSection
38 System.Web.Configuration.ProtocolsSection

复制代码
  int i = 0;
            var temp = sectionGroups.Get("system.web");
            if (temp is SystemWebSectionGroup systemWebSectionGroup)
            {
                foreach (var item in systemWebSectionGroup.Sections)
                {
                    i++;
                    Console.WriteLine($"{i} {item}");
                }

            }
复制代码

 

PagesSection下面的Controls和Namespaces

tagPrefix="asp" namespace="System.Web.UI.WebControls.WebParts" assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
tagPrefix="asp" namespace="System.Web.UI.WebControls.Expressions" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
tagPrefix="asp" namespace="System.Web.DynamicData" assembly="System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
===
System
System.Collections
System.Collections.Generic
System.Collections.Specialized
System.ComponentModel.DataAnnotations
System.Configuration
System.Linq
System.Text
System.Text.RegularExpressions
System.Web
System.Web.Caching
System.Web.DynamicData
System.Web.SessionState
System.Web.Security
System.Web.Profile
System.Web.UI
System.Web.UI.WebControls
System.Web.UI.WebControls.WebParts
System.Web.UI.HtmlControls
System.Xml.Linq

复制代码
            var section = systemWebSectionGroup.Sections.Get("pages");
            if (section is PagesSection pagesSection)
            {
                foreach (TagPrefixInfo item in pagesSection.Controls)
                {
                    Console.WriteLine($"tagPrefix=\"{item.TagPrefix}\" namespace=\"{item.Namespace}\" assembly=\"{item.Assembly}\"");
                }
                Console.WriteLine("===");
                foreach (NamespaceInfo item in pagesSection.Namespaces)
                {
                    Console.WriteLine(item.Namespace);
                }
            }
复制代码

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(403)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2016-04-20 What is the difference between task and thread?
点击右上角即可分享
微信分享提示