C# Configuration Manager . ConnectionStrings
<p>I have a console app containing an application configuration file containing one connection string as shown below:</p>

<pre><code>&lt;configuration&gt;
  &lt;connectionStrings&gt;
    &lt;add name="Target" 
      connectionString="server=MYSERVER; Database=MYDB; Integrated Security=SSPI;" /&gt;
  &lt;/connectionStrings&gt;
&lt;/configuration&gt;
</code></pre>

<p>When I pass this to my Connection using:</p>

<pre><code>ConfigurationManager.ConnectionStrings[1].ToString()
</code></pre>

<p>I have two values in there, hence using the second in the collection, my question is where is this second coming from?</p>

<p>I have checked the \Bin version and original and its not mine! Its obviously a system generated one but I have not seen this before? Can anyone enlighten me?</p>

<p>The mystery connection string is:</p>

<pre><code>data source=.\SQLEXPRESS;
          Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;
          User Instance=true
</code></pre>

<p>This isn't a problem as such I would just like to know why this is occuring? Thanks in advance!</p>

<p>For future reference to those who may or may not stumble on this, after discovering the <code>machine.config</code>, it's become apparent it is bad practice to refer to a config by its index as each stack will potentially be different, which is why "Keys" are used.</p>

<p>In this instance my code would be:</p>

<pre><code>ConfigurationManager.ConnectionStrings["Target"].ToString()
</code></pre>

<p>Cheers all! </p>
