The code below gives you the contents of the active configuration file.
var content = File.ReadAllLines(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
Check what you get like content, it contains key="name" value="Chan"or something else
if you specified <add key="name" value="Chan" />then ConfigurationManager.AppSettings ["name"] should be returned asChan
source
share