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 |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.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?