title: Getting error while changing Appsettings value in Web config from code behind
body: <p>I used the below code to change the appsetting key value in the web configuration of the application.</p>
  
  <pre><code>private void ChanngeDefaultPassword(string password)
  {
      try
      {
          var objConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
          AppSettingsSection objAppsettings = (AppSettingsSection)objConfig.GetSection("appSettings");
          objConfig.AppSettings.Settings["DEFAULT_PASSWORD"].Value = password;
          objConfig.Save();
      }
      catch (Exception ex)
      {
      }
  }
  </code></pre>
  
  <p>I am getting error stating </p>
  
  <blockquote>
    <p>Attempted to perform an unauthorized operation.</p>
  </blockquote>
  
  <p>This error is thrown in the step to save the configuration changes.</p>