弘帝企业智能建站系统交流平台

 找回密码
 立即注册
查看: 1885|回复: 0

【XML】读取web.config节点属性值

[复制链接]
发表于 2020-1-18 16:56:53 | 显示全部楼层 |阅读模式
XML:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime executionTimeout="240" maxRequestLength="8192000" />
    <pages controlRenderingCompatibilityVersion="4.0" />
  </system.web>
  <appSettings>
    <add key="host" value="host" />
    <add key="db" value="122.51.106.137" />
  </appSettings>
</configuration>

获取app的key=db的value值的实现
Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.Load(Path)
Set oNode = xmlDoc.selectSingleNode("configuration/appSettings/add[@key=""db""]")
Response.Write oNode.getAttribute("value")


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|弘帝企业智能建站系统 ( 皖ICP备07503252号 )

GMT+8, 2024-4-24 18:25 , Processed in 0.083398 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表