[WebMethod]
public void ChangeDbConnection(string dbConnectionString)
{
string fileName = HttpContext.Current.Server.MapPath(@"~/Web.Config"); System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(fileName); System.Xml.XmlNode node = doc.SelectSingleNode(@"/configuration/connectionStrings/add[@name='SqlConnection']");
if (node != null)
{
node.Attributes["connectionString"].Value = dbConnectionString;
doc.Save(fileName);
}
}