title: How to update settings in web.config File [asp.net]?
body: <p>How to update settings in <code>web.config</code> File in ASP.Net ? </p>
  
  <pre><code>&lt;appSettings&gt;
    &lt;add key="DataSource" value="localhost\SQLEXPRESS,1433"&gt;
    &lt;add key="InitialCatalog" value="CenTimetracker" /&gt;
    &lt;add key="user" value="uzer" /&gt;&lt;add key="password" value="pazz" /&gt;
    &lt;add key="IntegratedSecurity" value="True" /&gt;
    &lt;add key="configured" value="False" /&gt;
  &lt;/appSettings&gt;
  </code></pre>
  
  <p>I'm developing an ASP.NET website and im using web.config file to keep database connection details. as shown in the above code segment.</p>
  
  <p>And i'm using following code to retrieve saved application settings at the runtime</p>
  
  <pre><code>string dataSource = ConfigurationManager.AppSettings["DataSource"].ToString();
  </code></pre>
  
  <p>How can i assign value in a textbox to web.config file? I have used following piece of code, but it doesn't save the config file.  </p>
  
  <pre><code>ConfigurationManager.AppSettings["DataSource"] = TextDataSource.Text;
  </code></pre>