Reading Web.config

G

Guest

Hello,
I want to Read the value of the debug option from the Web.config file in My
ASP.NEt application. The Section is
<compilation defaultLanguage="vb" debug="true" />
Can someone help me with a code snippet. I know to read from the appsetting
section of the Web.config.

I basically want to show different error message based on the debug value in
the web.config file.

cheers,
siaj
 
W

William F. Robertson, Jr.

You can look at the HttpContext.IsDebuggingEnabled. This will basically
return the value of the compilation flag.

if ( Context.IsDebuggingEnabled )
//debug is set to true
else
//debug is set to false

HTH,

bill
 
G

Guest

thanks wiliam it helps....

William F. Robertson said:
You can look at the HttpContext.IsDebuggingEnabled. This will basically
return the value of the compilation flag.

if ( Context.IsDebuggingEnabled )
//debug is set to true
else
//debug is set to false

HTH,

bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top