[英]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.