473,788 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to read Config setting

Hello,
I am using VSNet 2003 and I am trying to programmaticall y detect if debug
attribute in the compilation tag is true or false. How can I do this ?
Thanks,
Jazz
Jan 6 '06 #1
7 4284
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 programmaticall y 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=tru e;
#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 programmaticall y 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 programmaticall y 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.ToStrin g()) 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 programmaticall y 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.ToStrin g()) 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 programmaticall y 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.Configur ation.Configura tionSettings.Ap pSettings["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.ToStrin g()) 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 programmaticall y 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.Configur ation.Configura tionSettings.Ap pSettings["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.ToStrin g()) 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 programmaticall y 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
1920
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 "<dllname>.dll.config" with no luck. Every time I try to read from the config file I get the following error: "The key 'systemName' does not exist in the appSettings configuration section." where "systemName" is the first setting in the...
3
7076
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 an example of what I'm trying to achieve: I tried a test by creating a simple app Test.exe that has some basic settings made available to it in the runtime file Test.exe.config.
1
5330
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 version="1.0" encoding="utf-8" ?> <configuration>
1
5361
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; Anybody able to give me idea how-to read by C# element which I add to the machine.config into the new single section?
2
1542
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 setting). Do I have to resort to using straight XML reading or is there some other way to access standard config settings? Thanks in advance. -Mark
4
3000
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 set to an instance of an object." message I thought this may have been to do with Virtual Directory settings but I've got the folder set as an application in IIS and asp.net is installed and working. My web.config file is Not Marked read-only and...
5
5736
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" and value is "monkey". I've tried the following ways to retrieve the value and only one works: //Returns null Configuration config = ConfigurationManager.OpenExeConfiguration(Assembly.GetEntryAssembly().Location); string monkey =...
9
4274
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 read the value of redirect from the error statusCode 404. My web.config looks like this: <customErrors mode="RemoteOnly" defaultRedirect="Error.aspx"> <error statusCode="404" redirect="Error404.aspx" /> </customErrors>
6
4772
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 expected this config file (.dll.config) to get put in my web app's bin folder along with it's .dll file when i did a build, and that didnt' happen either. do I have access to the app.config in my project or is it worthless? If so why can i add...
5
7866
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 setting is of course stored in the app.exe.config file located in the same directory as the exe. Upon closing the form, I save the user setting which then creates a user.config file in the appdata directory in my profile. This is all well and good....
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.