read config setting for ASP.Net (Compilation tag)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I am using VSNet 2003 and I am trying to programmatically detect if debug
attribute in the compilation tag is true or false. How can I do this ?
Thanks,
Jazz
 
I think that you can just open the web.config file as XML and look to
"//system.web/compilation" node and then check it's debug attribute:

Dim result As String
Dim doc As XmlDocument = New XmlDocument
doc.Load("C:\CDROM\wwwroot\OnLineTesting\web.config")
Dim xPath As String = "//system.web/compilation"
Dim node As XmlNode = doc.DocumentElement.SelectSingleNode(xPath)
If Not node Is Nothing Then
Dim attr As XmlAttribute = CType(node.Attributes("debug"),
XmlAttribute)
If Not attr Is Nothing Then
result = attr.Value
End If
End If

HTH
 
Back
Top