今天看到一招用DataSet修改WebConfig,真是简洁明了,一同分享
用DataSet修改WebConfig_web    public void write()
用DataSet修改WebConfig_职场_02        
{
用DataSet修改WebConfig_DataSet_05            
string newValue= this
.TextBox1.Text;
用DataSet修改WebConfig_DataSet_05            DataSet ds 
= new
 DataSet();
用DataSet修改WebConfig_DataSet_05            ds.ReadXml(Server.MapPath(
"")+"/web.config"
);
用DataSet修改WebConfig_DataSet_05
            ds.Tables[1].Rows[0][1= key1;
用DataSet修改WebConfig_DataSet_05            ds.AcceptChanges();
用DataSet修改WebConfig_DataSet_05            ds.WriteXml(Server.MapPath(
"")+"/web.config"
);
用DataSet修改WebConfig_DataSet_05            ds.Dispose();
用DataSet修改WebConfig_DataSet_05            
用DataSet修改WebConfig_职场_13        }