Solved

codebehind - find a web config value (compile debug)

Posted on 2010-11-22
7
555 Views
Last Modified: 2012-05-10
From my web config:

<compilation debug="false">


How do I find-out what this value is set to in my code behind?
0
Comment
Question by:knowlton
7 Comments
 
LVL 7

Assisted Solution

by:meispisces
meispisces earned 20 total points
Comment Utility
Not sure about your question.
0
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
Read the setting manually:
Dim doc As XmlDocument = New XmlDocument()

		doc.Load(MapPath("\web.config"))

		Dim compile As XmlNode = doc.DocumentElement.SelectSingleNode("system.web/compilation")



		If compile.Attributes("debug").InnerText.ToLower = "true" Then

			Debug.WriteLine("compilation=true")

		Else

			Debug.WriteLine("compilation=false")

		End If

Open in new window

0
 
LVL 5

Author Comment

by:knowlton
Comment Utility
???

I have to load it in as an XML file?

Doesn't .NET have built-in support for reading in web.config values?
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 29

Assisted Solution

by:Kumaraswamy R
Kumaraswamy R earned 200 total points
Comment Utility
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 280 total points
Comment Utility
Another way:

Dim config As System.Configuration.Configuration = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)
Dim section As System.Web.Configuration.CompilationSection = config.GetSection("system.web/compilation")
''read the Debug section
Response.Write(String.Format("Debug={0}", section.Debug))
0
 
LVL 5

Author Closing Comment

by:knowlton
Comment Utility
thx
0
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
No problem.

I see "Not sure about your question." was also helpful.  :)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now