Solved

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

Posted on 2008-06-11
4
4,297 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Close form "before" open 3 43
Write to a printer using vb.net 9 32
How to open form using item in Listbox. 8 21
location of a form 2 15
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

825 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