1

I inherited a bit of legacy code that was originally written in VS .NET 2003. I'm familiar with how ConfigurationManager works in newer versions of .NET, and have used it successfully to grab connections strings from the web.config. My problem is that this code does not seem to be pulling from the web.config at all, and utilizes a namespace I'm not familiar with.

Here is the relevant code:

using Microsoft.ApplicationBlocks.ConfigurationManagement;

public class ConfigurationBlock
{
    private static Hashtable GetSection()
    {
        HashTable configBlock = ConfigurationManager.Read();
        return configBlock;
    }
}

When I follow this code, it successfully pulls a huge list of data from ...somewhere. Is there a way to set where ConfigurationManager is pointing to that I'm not aware of, either programmatically or through the VS2003 interface? Any help would be greatly appreciated.

MadHenchbot
  • 1,306
  • 2
  • 13
  • 27

1 Answers1

2

The namespace is referring the Microsoft application blocks ( set of utilities) so if you have to use the Microsoft application blocks, you have to download and install it, and then reference the dll. However , in order to read values from web config or app config you can use

class:      ConfigurationManager 
Namespace:  System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)
Dan Hunex
  • 5,172
  • 2
  • 27
  • 38
  • Thanks, Dan. Just so I'm clear, the Microsoft ApplicationBlocks is some kind of a 3rd party utility then? Will I need to open a separate program in order to tell this utility where to be pulling data from? (For the record, my code works the way it is now, but I want to know where the table is that it's pulling its data from.) – MadHenchbot Jan 08 '13 at 17:05
  • That was exactly what I needed. TYVM! – MadHenchbot Jan 08 '13 at 17:59