0
我試圖使用Microsoft.Web.Administration API訪問'system.webServer /安全/授權'部分(在當前請求路徑)來查看匿名用戶(「*」)是否可以訪問。檢索「system.webServer/security/authorization」配置與Microsoft.Web.Administration API
要做到這一點我試圖通過訪問該部分配置:
WebConfigurationManager.GetSection(HttpContext.Current, "system.webServer/security/authorization")
我想,它的web.config文件被限制訪問特定的角色,這樣的路徑:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
<add accessType="Allow" roles="MyRole" />
</authorization>
</security>
</system.webServer>
</configuration>
令我驚訝的是,返回的對象是具有零ChildElements的ConfigurationSection實例。
這是爲什麼?
在此先感謝。