473,379 Members | 1,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

How to read Config setting

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
Jan 6 '06 #1
7 4239
Sorry, that should have been:
#if (DEBUG)
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jazz" wrote:
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

Jan 6 '06 #2
private bool IsDebugMode =false

#if (!DEBUG)
IsDebugMode=true;
#endif

--------------------
Cheers!
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jazz" wrote:
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

Jan 6 '06 #3
Peter,
I may miss one thing. The debug attribute I am talking about is the one in
the compilation tag in the web.config file, and I am doing asp.net stuff.
Will #if (DEBUG) still work?
I tried and it seems it doesn't work.
Thanks,
Jazz

"Peter Bromberg [C# MVP]" wrote:
Sorry, that should have been:
#if (DEBUG)
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jazz" wrote:
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

Jan 6 '06 #4
Jazz,
Prove it to yourself! Shouldn't take more than a minute to
Response.Write(IsDebug.ToString()) based on the setting in web.config.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jazz" wrote:
Peter,
I may miss one thing. The debug attribute I am talking about is the one in
the compilation tag in the web.config file, and I am doing asp.net stuff.
Will #if (DEBUG) still work?
I tried and it seems it doesn't work.
Thanks,
Jazz

"Peter Bromberg [C# MVP]" wrote:
Sorry, that should have been:
#if (DEBUG)
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jazz" wrote:
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

Jan 6 '06 #5
Answer is NO. I think DEBUG value depends on whether the code is built in
Debug mode or release mode and it has nothing to do with the one in
web.config.

"Peter Bromberg [C# MVP]" wrote:
Jazz,
Prove it to yourself! Shouldn't take more than a minute to
Response.Write(IsDebug.ToString()) based on the setting in web.config.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jazz" wrote:
Peter,
I may miss one thing. The debug attribute I am talking about is the one in
the compilation tag in the web.config file, and I am doing asp.net stuff.
Will #if (DEBUG) still work?
I tried and it seems it doesn't work.
Thanks,
Jazz

"Peter Bromberg [C# MVP]" wrote:
Sorry, that should have been:
#if (DEBUG)
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jazz" wrote:

> 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

Jan 6 '06 #6
web.config --file

<appSettings>
<add key="debug_flag" value="true" />
</appSettings>
string debug_flag=
System.Configuration.ConfigurationSettings.AppSett ings["debug_flag"];

"Jazz" wrote:
Answer is NO. I think DEBUG value depends on whether the code is built in
Debug mode or release mode and it has nothing to do with the one in
web.config.

"Peter Bromberg [C# MVP]" wrote:
Jazz,
Prove it to yourself! Shouldn't take more than a minute to
Response.Write(IsDebug.ToString()) based on the setting in web.config.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jazz" wrote:
Peter,
I may miss one thing. The debug attribute I am talking about is the one in
the compilation tag in the web.config file, and I am doing asp.net stuff.
Will #if (DEBUG) still work?
I tried and it seems it doesn't work.
Thanks,
Jazz

"Peter Bromberg [C# MVP]" wrote:

> Sorry, that should have been:
> #if (DEBUG)
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
>
>
> "Jazz" wrote:
>
> > 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

Jan 7 '06 #7
I know we can use appsettings. But what I really want is to utilize the
existing debug attribute value in the compilation tag in the web.config file.
<Compilation debug=true/>

"scottJ" wrote:
web.config --file

<appSettings>
<add key="debug_flag" value="true" />
</appSettings>
string debug_flag=
System.Configuration.ConfigurationSettings.AppSett ings["debug_flag"];

"Jazz" wrote:
Answer is NO. I think DEBUG value depends on whether the code is built in
Debug mode or release mode and it has nothing to do with the one in
web.config.

"Peter Bromberg [C# MVP]" wrote:
Jazz,
Prove it to yourself! Shouldn't take more than a minute to
Response.Write(IsDebug.ToString()) based on the setting in web.config.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jazz" wrote:

> Peter,
> I may miss one thing. The debug attribute I am talking about is the one in
> the compilation tag in the web.config file, and I am doing asp.net stuff.
> Will #if (DEBUG) still work?
> I tried and it seems it doesn't work.
> Thanks,
> Jazz
>
> "Peter Bromberg [C# MVP]" wrote:
>
> > Sorry, that should have been:
> > #if (DEBUG)
> > --
> > Co-founder, Eggheadcafe.com developer portal:
> > http://www.eggheadcafe.com
> > UnBlog:
> > http://petesbloggerama.blogspot.com
> >
> >
> >
> >
> > "Jazz" wrote:
> >
> > > 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

Jan 11 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Scott Graupmann | last post by:
I'm having trouble getting the settings out of my app.config file in a c# project. I have put the file in the root of the project and in the bin output directory with the name "app.config" and...
3
by: Danny | last post by:
Hello, I was wondering if anyone knew if it was possible to make changes to an application's App.config file at runtime and then be able to access those changes immediately. The following is...
1
by: MrXs | last post by:
i have a setting form for my program and wish to allow the setting to be saved and reopened to the last set setting on program startup.. lets say i have a xml file like this : <?xml...
1
by: vkrasner | last post by:
It works with VS2003 and does not in VS2005: in VS2003 : string sMyvalue = ConfigurationSettings.AppSettings; in VS2005 (does not work!!) string sMyvalue = ConfigurationManager.AppSettings; ...
2
by: Mark Friedman | last post by:
I've seen lots of documentation on how to create and read custom configuration settings but I'm interested in reading a standard setting (i.e. the loginUrl attribute of the authentication/forms...
4
by: Chris V | last post by:
I'm having a problem deploying my ASP.NET application to a WIN2k server. (IIS5 .NET 1.1) When I try to access ConfigurationSettings.AppSettings("WhateverValue") I get an "Object reference not...
5
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO"...
9
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. Is it programatically possible in VB.NET to read the contents of web.config's <customErrorselement? I looked at using ConfigurationSettings.AppSettings, but that doesn't work. I need to...
6
by: TS | last post by:
I cannot get this to work. I added an app.config to a project i reference from my web application project (vs 05) but can see no way to access the settings within it. the other thing is that I...
5
by: mmcd79 | last post by:
I built a VB.net application that makes use of a machine level DB connection string setting, and a user level starting location setting. The machine level setting and the default user based...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.