Solved

'ConfigurationManager' is not a member of 'Configuration'.

Posted on 2008-06-11
4
4,272 Views
Last Modified: 2012-06-27
I am working in Visual Studio 2005 and have 2 web apps.  Both of them have this in the VB Code Behind:
        Dim connectionString As String = ConfigurationSettings.AppSettings("theConnectionString").Replace("ClientName", Session("Client"))

ConfigurationSettings.AppSettings keeps getting a warning, so taking the warning suggestion I recoded it as:
        Dim connectionString As String = System.Configuration.ConfigurationManager.AppSettings("theConnectionString").Replace("ClientName", Session("Client"))

In the first app, it works without an error.

But in the second app, I get this error:
'ConfigurationManager' is not a member of 'Configuration'.

I cannot figure out what is basically different between the two apps.  Why is this happening?
0
Comment
Question by:wsturdev
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
apeter earned 500 total points
ID: 21762439
You have to add referece to the assembly "System.configuration"  to your project to enable ConfigurationManager.
0
 
LVL 1

Author Closing Comment

by:wsturdev
ID: 31466248
At first I didn't knwo what you meant, because I am dense...  but then got it.  Thanks!!
0
 
LVL 1

Expert Comment

by:thefarm
ID: 22317781
I have multiple projects in a solution. I had to right click on each project and add a reference to System.Configuration to each. Then I had to specify System.Configuraiton.ConfigurationManager.AppSettings("var")
Configuraiton.ConfigurationManager.AppSettings("var") alone did not work at removing the error.
I did not need the Imports System Configuration statement on the individual vb pages after doing this.
0
 
LVL 25

Expert Comment

by:apeter
ID: 22324798
You have to add "Imports" as well in each page.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now