config file using .net 2.0

A

Ashish

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
 
C

Christopher Reed

You need to add an <appSettings> node inside the <configuration> node.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top