473,399 Members | 3,656 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,399 software developers and data experts.

App.config not reading key

I have a simple C# VS 2005 console application that contains a class and an
app.config file.

My app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key = "KW_Geometry_CheckIn_Path" value="\\kwcyarm006
Batchplot\Input\Iput" />
<add key = "KW_Geometry_CheckOut_Path" value="yes" />
<add key = "PB_Geometry_CheckIn_Path"
value="\\PBCDEPM216\PBCDEP-Batchplot\input\IPut" />
<add key = "PB_Geometry_CheckOut_Path" value="yes" />
</appSettings>
</configuration>
I have included the reference to
using System.Configuration;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.Data;
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
My app code is:

string configpath =
ConfigurationManager.AppSettings.Get("KW_Geometry_ CheckIn_Path");

This will compile but won't read the value and shows a null string. I tried
using the ConfigurationSettings.AppSettings but get a deprecated error. Can
someone help with the proper syntax to retrieve the value from the app.config?

Thanks
Tastes like burning

Nov 8 '07 #1
1 1418
spurvia wrote:
I have a simple C# VS 2005 console application that contains a class and an
app.config file.
This is C++ newsgroup.

--
David Wilkinson
Visual C++ MVP
Nov 9 '07 #2

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

Similar topics

4
by: Fuzzyman | last post by:
There have been a couple of config file 'systems' announced recently, that focus on building more powerful and complex configuration files. ConfigObj is a module to enable you to much more *simply*...
3
by: Marek | last post by:
Hi there, my WinForm application has to be installed in "no-touch-deployment" mode, so users can run it from the web. I need to read application's .config file but it does not work in ...
2
by: KennethBohman | last post by:
Hi everybody, Question: how can I use the executable.config-files during installation? The answer might seem obvious, but there is apparently more to it! My itention was, as part of the...
4
by: Jon Maz | last post by:
Hi All, I'm getting to grips with PHP and Apache (on Windows for current development, production site will be on Linux), and have a simple (I hope!) request. When you change the httpd.conf...
3
by: spacekid | last post by:
Hi there I am exposing a c# assembly as a COM component (regasm /codebase) and calling it from classic asp. When I try to call the ConfigurationSettings.AppSettings function in the c# assembly,...
2
by: PMac | last post by:
I'm trying to execute a stand-alone console application from an aspx page when a use clicks a button on that page. On the aspx page is the following lines of pertinent code: private void...
1
by: savajx1 | last post by:
I am using the new "web deployment addin" in VS 2005 to output my web site. The web site is correctly output (assemblies generated in the \bin subdirectory). The web site on my developement...
5
by: RedHair | last post by:
In ASP.NET web application, where is the best place to store a application scope variable?(read only) Web.Config file or application object? Which performance is better while reading the data?
1
by: mattgarvin | last post by:
Hello, my company hosts many websites, and we want to add a Feedback Form (like "Contact Us") that can be re-used on all of them just by "dropping in" a new directory containing the code. My boss...
2
by: Tom Baxter | last post by:
Hi everyone, I have a small block of code that encrypts a database connection string in a ..config file, but I'm not sure where the encryption key comes from. There is no problem with this code...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.