简体   繁体   English

如何阅读system.webserver配置部分?

[英]How to read system.webserver configuration section?

Is there any 'nice' way to read configuration section group of IIS7 by using WebConfigurationManager o anything? 是否有任何“不错”的方式通过使用WebConfigurationManager来读取IIS7的配置节组? I tried to read the authorization section but WebConfigurationManager.GetSection() returns an 'IgnoredSection' instance. 我尝试阅读授权部分,但WebConfigurationManager.GetSection()返回了“ IgnoredSection”实例。 This is what my code looks like... 这就是我的代码的样子...

authSection = WebConfigurationManager.GetSection("system.webServer/security/authorization", HttpContext.Current.Request.Path)
Configuration webConfig = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); 
ConfigurationSection cs = webConfig.GetSection("system.webServer");
if (cs != null)
{
    XDocument xml = XDocument.Load(new StringReader(cs.SectionInformation.GetRawXml()));
    ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:“无法读取配置部分'system.webServer / management / delegation',因为它缺少模式 - Error: "The configuration section 'system.webServer/management/delegation' cannot be read because it is missing schema IIS忽略system.webServer staticContent部分 - IIS ignores system.webServer staticContent section system.webserver/rewrite/allowedservervariables 无法读取,因为它缺少部分声明 - system.webserver/rewrite/allowedservervariables cannot be read beacuase it is missing a section declaration 如何从web.config system.web和system.webServer读取Ihttpmodule - how to Read Ihttpmodule from web.config system.web and system.webServer 在添加处理程序<system.webServer> - Adding handler in <system.webServer> 重写如何在web.config system.webserver中工作 - How does the rewrite works in web.config system.webserver 如何以编程方式更改web.config中的system.webServer / defaultDocument - How to change system.webServer/defaultDocument in web.config programmatically 使用Microsoft.Web.Administration API检索“ system.webServer / security / authorization”配置 - Retrieving “system.webServer/security/authorization” configuration with Microsoft.Web.Administration API 带有system.webServer / modules的Signalr / hub 404 - Signalr/hubs 404 with system.webServer/modules 将Elmah模块添加到system.webserver时出错 - Error adding elmah modules to system.webserver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM