string tempPath = this.Request.PhysicalApplicationPath + "web.config";
XmlDocument xd = new XmlDocument();
xd.Load(tempPath);
XmlNode xn = xd.SelectSingleNode("//add[@key='test']");//获取节点属性
XmlNode xn = xd.SelectSingleNode("/configration/appSetting/add[@key='test']");
Response.Write(xn.Attributes["value"].Value);
本文介绍了一种使用C#从web.config文件中读取特定节点属性的方法。通过实例展示了如何定位到配置文件中的指定节点并获取其属性值。
4845

被折叠的 条评论
为什么被折叠?



