Senator Guerra Souty original series calendar,replica hublot blue steel peach pointer collocation of rolex replica Rome digital scale, track type minute replica watches scale shows that the classical model is swiss replica watches incomparable, wearing elegant dress highlights.
mr-ponna.com

 

YOU ARE HERE: HOME Questions How to update web config programatically



Updating config files dynamically

View(s): 29806

How to update web.config programatically?

Answer 1)
 
Below is sample code to update web.config:

protected void EditConfigButton_Click(object sender, EventArgs e)
{
   Configuration objConfig = WebConfigurationManager.OpenWebConfiguration("~");
   AppSettingsSection objAppsettings = (AppSettingsSection)objConfig.GetSection("appSettings");    
   //Edit
    if (objAppsettings != null)

    {
        objAppsettings.Settings["test"].Value = "newvalueFromCode";
        objConfig.Save();
    }
}

  Asked in:  TCS (Tata Consultancy Services)   Expertise Level:  Experienced
  Last updated on Sunday, 11 November 2012
5/5 stars (14 vote(s))

Register Login Ask Us Write to Us Help