Reading Web.config

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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

Back
Top