Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2007

Tip: Looking for answers? Try searching our database.

App.config not reading key

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
spurvia - 08 Nov 2007 22:09 GMT
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
David Wilkinson - 09 Nov 2007 13:30 GMT
> I have a simple C# VS 2005 console application that contains a class and an
> app.config file.

This is C++ newsgroup.

Signature

David Wilkinson
Visual C++ MVP


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.