OpenMappedExeConfiguration and configuration, configSections,sectionGroup values

D

Dave

I'm access a non default application config file with
OpenMappedExeConfiguration() and it works great for "appSettings"
values, but I cannot get it to work for configSection values / with
NameValueCollection.

Here is some sample code:

ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = @"C:\Program Files\KAF\bin
\Latch2.exe.config";
System.Configuration.Configuration configFile =
ConfigurationManager.OpenMappedExeConfiguration(fileMap,
ConfigurationUserLevel.None);

// the following works fine
int userLoginFrequency =
Convert.ToInt32(configFile.AppSettings.Settings["UserLoginFrequency"].Value);

// but this does not work - jrArgsCollection being null
NameValueCollection jrArgsCollection = (NameValueCollection)
ConfigurationManager.GetSection("MultiInvocationGroup/
JRArgumentsSection");

the latter syntax worked great when i was using OpenExeConfiguration()
instead of OpenMappedExeConfiguration() but it doesn't work anymore.

any help would be much appreciated, thanks, dave
 
D

Dave

I'm access a non default application config file with
OpenMappedExeConfiguration() and it works great for "appSettings"
values, but I cannot get it to work for configSection values / with
NameValueCollection.

Here is some sample code:

ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = @"C:\Program Files\KAF\bin
\Latch2.exe.config";
System.Configuration.Configuration configFile =
    ConfigurationManager.OpenMappedExeConfiguration(fileMap,
ConfigurationUserLevel.None);

// the following works fine
int userLoginFrequency =
Convert.ToInt32(configFile.AppSettings.Settings["UserLoginFrequency"].Value­);

// but this does not work - jrArgsCollection being null
NameValueCollection jrArgsCollection = (NameValueCollection)
    ConfigurationManager.GetSection("MultiInvocationGroup/
JRArgumentsSection");

the latter syntax worked great when i was using OpenExeConfiguration()
instead of OpenMappedExeConfiguration() but it doesn't work anymore.

any help would be much appreciated, thanks, dave

So does no one know the answer to this? I'm a bit surprised...
 
Top