473,322 Members | 1,699 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,322 software developers and data experts.

Configuration using XML

Hello:
I have read about using the XML .config files with Web Applications
(Web.config) or console and winforms applications (app.exe.config). But i
want to use it with class library in C# and i don't know how to do it.
I have tried to add a configuration file to my project; Visual Studio
created this app.config file and i added the following code in it:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="RutaFicheroRss" value="C:\Documents and Settings\Javier\Mis
documentos\Visual Studio Projects\WebRef\WebRefRss.xml"/>
</appSettings>
</configuration>

After, in one of my classes i wrote this code:
System.Configuration.AppSettingsReader lector = new
System.Configuration.AppSettingsReader();
System.Object resultado = lector.GetValue("RutaFicheroRss",
Type.GetType ("System.String"));

But when i execute the GetValue method, an exception is thrown, with this
message:
Exception type 'System.InvalidOperationException' in system.dll
Additional information: The key 'RutaFicheroRss' doesn't exist in the
configuration section of appSettings.

I have translated the message from Spanish, with is my language, perhaps in
an English version of Visual Studio and .NET the messages will be a little
different, but i think not a lot.

I have checked i don't get wrong and the key is, in fact, RutaFicheroRss, so
i don't know what is wrong.
Please, help me, i need to finish this application very soon.
Thank you.
Nov 12 '05 #1
0 816

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

Similar topics

2
by: Alexander Kienzle | last post by:
I'm new to Java programming. I'm developing a Servlet for tomcat which needs an external configuration file. With external I mean a file (in XML format) which is customizable and not contained in...
3
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with...
5
by: Water Cooler v2 | last post by:
I know that we can add a single name value entry in app.config or web.config in the configuration/configSettings/appSettings section like so: <add key="key" value="value" /> Question: I want...
0
by: metaperl | last post by:
A Comparison of Python Class Objects and Init Files for Program Configuration ============================================================================= Terrence Brannon bauhaus@metaperl.com...
4
by: Michael Lang | last post by:
I was basically wanting to know how to use the System.Configuration namespace to be able to load an arbitrary number of unknown attributes on an element in a custom section in the .config into a...
8
by: Alberto | last post by:
Can you tell me how to read and modify a value in the app.config file using this class? Thank you very much
7
by: Peter Bradley | last post by:
OK. A bit behind the times, I know; but we're just moving over to .NET 2.0. How on earth do you manage configuration settings in a class library in .NET 2.0? In version 1.1, we used a handy class...
7
by: Arno R | last post by:
Hi all, I am sending mail from my apps with CDO nowadays. However I have one client where this will not work until now. I am thinking this is related to the provider where the client has his...
1
by: Miro | last post by:
I am going throug a vb 2005 book, but I am using vs 2008 professional, and I cant seem to find a menu option its talking about. I am wondering if this has moved - i cannot seem to find it for the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.