12

WebConfigurationManager o何かを使用してIIS7の構成セクショングループを読み取る「良い」方法はありますか? 認証セクションを読み込もうとしましたが、WebConfigurationManager.GetSection() は「IgnoredSection」インスタンスを返します。これは私のコードがどのように見えるかです...

authSection = WebConfigurationManager.GetSection("system.webServer/security/authorization", HttpContext.Current.Request.Path)
4

1 に答える 1

8
Configuration webConfig = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); 
ConfigurationSection cs = webConfig.GetSection("system.webServer");
if (cs != null)
{
    XDocument xml = XDocument.Load(new StringReader(cs.SectionInformation.GetRawXml()));
    ...
}
于 2014-05-28T18:33:52.390 に答える