清风的blog 优然探索

更新Web.config

private void UpdateConfig(string KeyName, string Xvalue)
        {
            XmlDocument doc = new XmlDocument();
            string sPath = Server.MapPath("web.config");
            doc.Load(sPath);
            XmlNode node = doc.SelectSingleNode(@"//add[@key='" + KeyName + "']");
            XmlElement ele = (XmlElement)node;
            ele.SetAttribute("value", Xvalue);
            doc.Save(sPath);
        }

2009年11月29日 | 发布:admin | 分类:程序语言 | 评论:0

发表留言: