I coded a C# project, and I configured app.config file as follows:
<appSettings>
<add key="smUserName" value= "XXX"/>
<add key="smPassword" value= "XXX"/>
</appSettings>
But then I cannot get the smUserName and smPassword values from app.config:
using System.Configuration;
// more code snipped...
public static string smUserName = ConfigurationManager.AppSettings.Get("smUserName").ToString();
public static string smPassword = ConfigurationManager.AppSettings.Get("smPassword").ToString();
Despite the using System.Configuration statement, compiling this code gives the error “The name ‘ConfigurationManager’ does not exist in the current context”.
If the problem is that the code does not compile, try adding a reference to the
System.Configurationassembly.