Read and assign appSetting value
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/270287/editing-web-config-programatically">Editing Web.config programatically</a>  </p>
</blockquote>



<p>I have a web service which reads credentials from a config file (web.config).  I want to provide a option to user by providing them with a radio button and based on the radiobutton I want to assign relevant value to appsetting key.</p>

<p>Example:</p>

<pre><code>&lt;add key="sample" value="abc"&gt; &lt;!-- The webservice specifically looks for key named 'sample' --&gt;
</code></pre>

<p>I want to have two more keys,</p>

<pre><code>&lt;add key="sample_development" value="dev"&gt;
&lt;add key="sample_test" value="test"&gt;
</code></pre>

<p>And if user chooses 'test' radio button on the form, I want to read key 'sample_test' and assign its value to key 'sample' before I make a call to webservice.</p>

<p>sounds bit weird, but  that's my requirement. :)</p>
