The type or namespace name 'Configuration' does not exist in the namespace 'System.Web'
This error will crop up if you try to use Configuration namespace in VS 2005 in the same way we used to access configuration namespace in VS 2003. In .NET 2.0, the ConfigurationManager class is the new mechanism to handle configuration information instead of ConfigurationSettings class in 1.x.
This namespace is already added by default in the Web projects, but we need to add manually for class library projects.
For this to work, we need to add System.Configuration DLL via "Add Reference" dialog box. Right click References and select Add Reference, then select System.Configuration under the .NET tab.
Code:
using System.Configuration;
class A
{
/// <summary>
/// Returns the connection string from the web.config file
/// </summary>
/// <returns></returns>
public static string GetConnectionString()
{
///<remarks>
///Get the DB Connection String from web.config
///</remarks>
return ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
}