I am trying to pull an
However, in .NET2.0, using this code will cause the following error:
The reason is because the original
Hope this will help someone.
appSettings
key from my web.config. In .NET 1.1, we usually use:System.Configuration.ConfigurationSettings.AppSettings["strConnection"].ToString();
However, in .NET2.0, using this code will cause the following error:
'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings'
So I just change my code to the following, according to the error above. But the problem is I can’t find ConfigurationManager
in the System.Configuration
.The reason is because the original
System.Configuration.ConfigurationSettings
class is point to the System.dll
assembly. There is another new the System.Configuration.dll
assembly with the new ConfigurationManager
class. In this case, you need to add in the System.Configuration.dll
as a reference to your application before you can use it.Hope this will help someone.