OpenMappedExeConfiguration and configuration, configSections,sectionGroup values

  • Thread starter Thread starter Dave
  • Start date Start date
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
 
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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top