OpenWebConfiguration 的难题,up有分
以下代码从一个目录中读入配置文件,然后显示在gridview上L
Dim appPath As String = "~\Data\ "
Dim parentPath As String = GetParentPath(appPath)
Dim config As Configuration = WebConfigurationManager.OpenWebConfiguration(appPath)
Dim auth As AuthorizationSection = CType(config.GetSection( "system.web/authorization "), AuthorizationSection)
Dim parentConfig As Configuration = WebConfigurationManager.OpenWebConfiguration(parentPath)
Dim parentAuth As AuthorizationSection = CType(parentConfig.GetSection( "system.web/authorization "), AuthorizationSection)
ParentRuleCount = parentAuth.Rules.Count
GetNotDeletableRules(config)
Dim arr As New ArrayList()
Dim entry As AuthorizationRule
For Each entry In auth.Rules
arr.Add(entry)
Next entry
Session(cRULES) = arr '保存数据,以便于分页显示
dataGrid.DataSource = arr
dataGrid.DataBind()
事实上,OpenWebConfiguration 无论如何也不能读到正确的文件,只能读到第一个子目录的web.config,谁知道是怎么回事呢?up者也有分的
------解决方案--------------------OpenWebConfiguration
Returns a Configuration object representing the current Web application in the design host.
当成xmlfile来parse吧
------解决方案--------------------既然up有分,我就up一下!
呵呵!~
------解决方案--------------------看看webconfig
------解决方案--------------------UP
------解决方案--------------------学习
------解决方案--------------------只有up的份