1. private Configuration _configuration;
  2. private ConfigurationSectionGroupCollection sectionGroups;
  3. private SystemWebSectionGroup systemWebSectionGroup;
  4.  
  5. [SetUp]
  6. public void TestSetUp()
  7. {
  8. var filePath = @"/";
  9. _configuration = WebConfigurationManager.OpenWebConfiguration(filePath, "Test");
  10. sectionGroups = _configuration.SectionGroups;
  11. systemWebSectionGroup= sectionGroups.Get("system.web") as SystemWebSectionGroup;
  12. }
  13.  
  14. [TearDown]
  15. public void TestTearDown()
  16. {
  17. _configuration = null;
  18. }

默认有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

  1. int i = ;
  2. var temp = sectionGroups.Get("system.web");
  3. if (temp is SystemWebSectionGroup systemWebSectionGroup)
  4. {
  5. foreach (var item in systemWebSectionGroup.Sections)
  6. {
  7. i++;
  8. Console.WriteLine($"{i} {item}");
  9. }
  10.  
  11. }

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

  1. var section = systemWebSectionGroup.Sections.Get("pages");
  2. if (section is PagesSection pagesSection)
  3. {
  4. foreach (TagPrefixInfo item in pagesSection.Controls)
  5. {
  6. Console.WriteLine($"tagPrefix=\"{item.TagPrefix}\" namespace=\"{item.Namespace}\" assembly=\"{item.Assembly}\"");
  7. }
  8. Console.WriteLine("===");
  9. foreach (NamespaceInfo item in pagesSection.Namespaces)
  10. {
  11. Console.WriteLine(item.Namespace);
  12. }
  13. }

system.web section group下的section的更多相关文章

  1. web.config add handlers and httpmodule to System.Web section.

    <?xml version="1.0" encoding="utf-8"?> <!-- For more information on how ...

  2. system.web下的HttpModules节点和system.webServer下的modules节点的配置区别

    [转]自定义HttpModule的一些经验--配置篇 自定义web模块,需继承System.Web.IHttpModule接口 一:拦截对该服务器所有的http请求. 第一步:将自定义module类使 ...

  3. 在.net2.0下使用System.Web.Script.Serialization;

    最近,在弄json字符串转为对象.需要添加这个引用System.Web.Script.Serialization;因为版本必须是dotnet2.0的原因,发现很多解决方案不适合自己.故使用这种解决办法 ...

  4. Web.config的system.webServer节点与system.web的区别

    Web.config 文件中的 system.webServer 节用于指定适用于 Web 应用程序的 IIS 7.0 设置.system.WebServer 是 configuration 节的子级 ...

  5. 定义了重复的system.web.extensions/scripting/scriptResourceHandler怎么办

    今天移转系统,都配置好之后,系统报错说我的web服务下的web.config 定义了重复的 system.web.extensions/scripting/scriptResourceHandler ...

  6. 从Owin到System.Web.Http.Owin的HttpMessageHandlerAdapter看适配器模式

    .mytitle { background: #2B6695; color: white; font-family: "微软雅黑", "宋体", "黑 ...

  7. 浅从System.Web.Http.Owin的HttpMessageHandlerAdapter看适配器模式

    本文版权归博客园和作者吴双本人共同所有 转载和爬虫请注明原文地址 www.cnblogs.com/tdws 一.写在前面 适配器模式(Adapter) 可用来在现有接口和不兼容的类之间进行适配.有助于 ...

  8. [A]System.Web.WebPages.Razor.Configuration.HostSection 无法强制转换为 [B]System.Web.WebPages.Razor.Configuration.HostSection。

    记录下mvc4升级到mvc5后,运行项目提示: “/”应用程序中的服务器错误. [A]System.Web.WebPages.Razor.Configuration.HostSection 无法强制转 ...

  9. IIS 无法读取配置节&quot;system.web.extensions&quot;,由于它缺少节声明

    作者:jiankunking 出处:http://blog.csdn.net/jiankunking 今天在本地安装iis.搭建站点,应用程序的时候报错以下的错误: server错误 Internet ...

随机推荐

  1. centos右上角wired图标消失有效解决方案

    最近在学习Linux配置nginx时,左上角的wired图标突然没了,很神奇.然后在网上按着很多博客说的去改,都没用,最后终于根据下面参考博客内的方案解决了问题,嘿嘿. mv /var/lib/Net ...

  2. 扩增子分析解读4去嵌合体 非细菌序列 生成代表性序列和OTU表

    本节课程,需要先完成 扩增子分析解读1质控 实验设计 双端序列合并 2提取barcode 质控及样品拆分 切除扩增引物 3格式转换 去冗余 聚类   先看一下扩增子分析的整体流程,从下向上逐层分析 分 ...

  3. 梦想CAD控件文字COM接口知识点

    一.参数绘制文字 在CAD设计时,需要绘制文字,用户可以设置设置绘制文字的高度等属性. 主要用到函数说明: _DMxDrawX::DrawText 绘制一个单行文字.详细说明如下: 参数 说明 DOU ...

  4. 怎么让Eclipse对html和js代码自动提示

    使用eclipse自带的插件,无需另外安装插件,具体步骤如下1.打开eclipse→Windows→Preferences→Java→Editor→Content Assist修改Auto Activ ...

  5. Linux常用命令——关机与重启命令

    1.shutdown命令 shutdown [选项] 时间 --使用shutdown进行关机或重启会正确保存正在使用的服务,其他命令有一定的危险性,建议最好使用shutdown命令进行关机重启 选项: ...

  6. 封装一个获取module.exports内容的方法

    let fs = require('fs') let req = (moduleName) => { //content代表的是文件内容 let content = fs.readFileSyn ...

  7. python3.x Day1 用户登录程序练习

    训练1: 模拟登陆: 1. 用户输入帐号密码进行登陆 2. 用户信息保存在文件内 3. 用户密码输入错误三次后锁定用户 login2.py: #!/usr/bin/env python # -*- c ...

  8. Journals in Fluid Mechanics

    journal of fluid mechanics physics of fluids annual review of fluid mechanics

  9. HYSBZ - 1050(旅行comf 并查集Java实现)

    HYSBZ - 1050(旅行comf Java实现) 原题地址 解法:枚举每一条边,对于这条边,我们需要找到集合中和其值相差最小的最大边,这个集合是指与包括i边在内的ST联通集.对于这一要求,我们只 ...

  10. c#读取.config文件内容

    今天在做项目的时候,由于程序同时启动多种情况的数据,测试分为多个人,就需要把数据分离开来,于是用了一个临时的配置文件,让测试在配置文件修改相应数据从而让各个测试互相不影响! 步骤: 第一步:添加一个A ...