Solved

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

Posted on 2008-06-11
4
4,329 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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