title: reading external configuration file
body: <p>I have a c# .Net console app that performs FTP operations.
  Currently, I specify the settings in a custom configuration section, e.g.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="ftpConfiguration" type="FileTransferHelper.FtpLibrary.FtpConfigurationSection, FileTransferHelper.FtpLibrary" /&gt;
    &lt;/configSections&gt;
  
    &lt;ftpConfiguration&gt;
        &lt;Environment name="QA"&gt;
          &lt;sourceServer hostname="QA_hostname"
                        username="QA_username"
                        password="QA_password"
                        port="21"
                        remoteDirectory ="QA_remoteDirectory" /&gt;
          &lt;targetServer downloadDirectory ="QA_downloadDirectory" /&gt;
  
        &lt;/Environment&gt;
    &lt;/ftpConfiguration&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I would like to specify, in the command line, an external configuration file.</p>
  
  <p>HOWEVER!!!... </p>
  
  <p>I just realized that the above "FtpConfiguration" section doesn't truly belong in the application's app.config. My ultimate goal is that I will have many scheduled tasks that execute my console app like this:</p>
  
  <pre><code>FileTransferHelper.exe -c FtpApplication1.config
  FileTransferHelper.exe -c FtpApplication2.config
  ...
  FileTransferHelper.exe -c FtpApplication99.config
  </code></pre>
  
  <p>Consequently, I believe I've gone down the wrong path and what I really want is something to read in my custom xml document but continue to use System.Configuration to get the values... as opposed to reading an XmlDocument and serializing it to get nodes/elements/attributes. (Although, I'm not against the latter if someone can show me some simple code)</p>
  
  <p>Pointers would be greatly appreciated. Thanks.</p>
  
  <p>Update:
  The answer I accepted was a link to another StackOverflow question, repeated here with my code - below which was exactly what I was looking for -- using the OpenMappedExeConfiguration to open my external config file</p>
  
  <pre><code>ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
  configFileMap.ExeConfigFilename = @"D:\Development\FileTransferHelper\Configuration\SampleInterface.config";
  
  Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
  
  FtpConfigurationSection ftpConfig = (FtpConfigurationSection)config.GetSection("ftpConfiguration");
  </code></pre>