473,775 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading a Element Collection From a App.config file

1 New Member
Hi,
i am using a app.config file in my console application.
App.config code-->

<configuratio n>
<configSections >
<section name="enterpris eLibrary.Config urationSource" type="Microsoft .Practices.Ente rpriseLibrary.C ommon.Configura tion.Configurat ionSourceSectio n, Microsoft.Pract ices.Enterprise Library.Common, Version=3.1.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" />
</configSections>
<enterpriseLibr ary.Configurati onSource selectedSource= "File Configuration Source">
<sources>
<add name="File Configuration Source" type="Microsoft .Practices.Ente rpriseLibrary.C ommon.Configura tion.FileConfig urationSource, Microsoft.Pract ices.Enterprise Library.Common, Version=3.1.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a"
filePath="CS.co nfig" />
<add name="System Configuration Source" type="Microsoft .Practices.Ente rpriseLibrary.C ommon.Configura tion.SystemConf igurationSource , Microsoft.Pract ices.Enterprise Library.Common, Version=3.1.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" />
</sources>
</enterpriseLibra ry.Configuratio nSource>

</configuration>

in the above code one config section "enterpriseLibr ary.Configurati onSource" is present. with in this elements collection ("sources"). i want to get the value of the filePath i.e CS.Config present in side the "Sources" element in my console application.

can any one help me in getting the values from app.config file.
Thanks alot in advance.
Sep 28 '08 #1
1 2591
joedeene
583 Contributor
...so are you asking, basically, how to read the values from the App.config file? how about looking into the system.configur ation.Configura tionManager class? you might find it useful...

joedeene
Sep 28 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5962
by: Jeff Thies | last post by:
I'm (still) having trouble reading the contents of an IFRAME (IE5). I have this: var my_iframe = document.frames; What I would want to do at that point is get either the contentWindow.document or the contentDocument depending on whether this was IE or Mozilla. (Thanks Lasse.) I'm not finding this.
12
4912
by: Anna | last post by:
Hi all, I posted the same question this afternoon but my message isn't showing up, so I thought I'd give it another try.... in case you should see it later I apologize for posting the same question twice! Here it is: I am having problems reading the value of a text Node. I think it has to do with the fact that the text is in a <span> tag. I have a table and in each <td> I have text + a checkbox. I want to retreive the text next to the...
1
5026
by: Duncan Allen | last post by:
I'm trying to use aspnet_setreg to encrypt user names & password used in the web.config file for use in the indentity element. When the website runs I get the message 'Error reading the password from the registry'. I'm using Windows XP SP2, Framework 1.1 . The code in the web.config file is : <identity impersonate="true" password="registry:HKLM\SOFTWARE\MyCompany\MyApp\Website\Identity\ASPNET_SETREG,password...
0
1459
by: chris.millar | last post by:
I am using the ReadXMLSchema method of system.data.dataset to read a schema into a dataset. I have an XML file that I build up and wish to do a .Update against a database. The dataset doesn't have a schema and takes the following form: xml: <?xml version="1.0" encoding="utf-8"?> <DataSetEntities xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:guids="urn:schemas-microsoft-com:guids" xmlns="C:/DACXML/EntityAttribute.xsd">
3
8710
by: Robert | last post by:
I have a number of web projects converted from 1.1 to 2.0 in VS2005. I am methodically seeing the error below: The element 'compilation' has invalid child element 'compilers'. List of possible elements expected: 'assemblies, buildProviders, codeSubDirectories, expressionBuilders'. Here's what the web config looks like. The error doesn't cause any issues and according to the MSDN documentation this is valid. So why is VS2005
2
5106
by: news.microsoft.com | last post by:
Hi After conducting a several searches, I wasn't sure where to post this question. So my apologiesbefore hand for double posting this and possibly posting to the wrong forum(s). Okay, I have any application that uses the data access application building block from Microsoft's Enterprise Library (patterns and practices site). I want to allow the users to select the database connection. To do this, I thought I could read the...
4
6486
by: Dan | last post by:
H, i want to use for one specific application the default membership provider as defined by default in machine.config, except one element: i want to use requiresUniqueEmail="false" instead of the default configuration in machine.config (which is set on "true"). So i did this in the web.config of the application: <membership defaultProvider="MyMembershipProvider"> <providers>
5
3844
by: Kevin S Gallagher | last post by:
I have been attempting to read a value from the starting executable while in a DLL. So far have tried the following were "Test" is a defined value in the EXE. What is returned is a blank/empty string System.Configuration.ConfigurationManager.AppSettings.Item("Test") Did some research on Google but only found people untried suggestions, none that work in .NET Framework 2.
0
1341
by: Adam dR. | last post by:
I would like to create an XSD that will verify the xml below has one <configelement with the name attribute equal to 'DBC' all other <configelements are optional and their values don't matter. I cannot restrict other <configelements from being there. Is this possible with XSD? If so could someone help me with an example? <-- This should be VALID be cause it has one and only one config element with name 'DBC' --/> <project> <config...
0
9621
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...
1
10046
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,...
0
9915
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6717
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
5358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
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.