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

config file using .net 2.0

I am writing a business layer component and want to store some
configuration parameters for it, i dont want to use web.config of the
web application that would use this business layer because of testing
reasons...

I created a file called Mydllname.dll.config file and set the build
action to 'Copy Always'.

Iam trying to read the configuration elements using following code..
string myValue = ConfigurationManager.AppSettings["somekey"];

and my config file looks like

<configuration>
<add key ="somekey" value ="somevalue"/>
</configuration>
but the appsettings collection is empty...,

can some one guide me to right direction ?

many thanks
Feb 10 '06 #1
3 1005
You need to add an <appSettings> node inside the <configuration> node.

<configuration>
<appSettings>
<add key ="somekey" value ="somevalue"/>
</appSettings>
</configuration>

--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Ashish" <as*****@thisisjunk.com> wrote in message
news:uh**************@TK2MSFTNGP15.phx.gbl...
I am writing a business layer component and want to store some
configuration parameters for it, i dont want to use web.config of the web
application that would use this business layer because of testing
reasons...

I created a file called Mydllname.dll.config file and set the build action
to 'Copy Always'.

Iam trying to read the configuration elements using following code..
string myValue = ConfigurationManager.AppSettings["somekey"];

and my config file looks like

<configuration>
<add key ="somekey" value ="somevalue"/>
</configuration>
but the appsettings collection is empty...,

can some one guide me to right direction ?

many thanks

Feb 11 '06 #2

thanks Christopher,
but iam already doing that

Christopher Reed wrote:
You need to add an <appSettings> node inside the <configuration> node.

<configuration>
<appSettings>
<add key ="somekey" value ="somevalue"/>
</appSettings>
</configuration>

Feb 13 '06 #3
So, do you still have the problem?
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Ashish" <as*****@thisisjunk.com> wrote in message
news:e$*************@TK2MSFTNGP11.phx.gbl...

thanks Christopher,
but iam already doing that

Christopher Reed wrote:
You need to add an <appSettings> node inside the <configuration> node.

<configuration>
<appSettings>
<add key ="somekey" value ="somevalue"/>
</appSettings>
</configuration>

Feb 14 '06 #4

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*...
6
by: Rich | last post by:
Hello, I picked up this example on using the Reflection namespace for loading forms/classes on the fly at msdn http://msdn.microsoft.com/library/default.asp?...
17
by: Fred Nelson | last post by:
Hi: I have written several web applications that obtain their connection strings from the web.config file. This is very easy to use and it makes it easy to move an app from development into...
20
by: tomerfiliba | last post by:
hey i've been seeing lots of config-file-readers for python. be it ConfigObj (http://www.voidspace.org.uk/python/configobj.html) or the like. seems like a trend to me. i came to this conclusion...
5
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"...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.