c# - c# winform app.config "&" char 在字符串中不起作用
问题描述
在我的 app.config 文件中,我想添加 param2="&password=" 但它不起作用,因为 "&" char 知道为什么吗?
<configSections>
<sectionGroup name="API">
<section name="loginURL" type="System.Configuration.SingleTagSectionHandler"/>
</sectionGroup>
</configSections>
<API>
<loginURL url="http://test.fr:81/api/sm?" param1="name=" param2="&password="/>
</API>
解决方案
由于web.config
文件是 XML,它们遵循正常的 XML 规则。这意味着属性是 XML 编码的。要使用&
标志,您应该将其替换为&
<configSections>
<sectionGroup name="API">
<section name="loginURL" type="System.Configuration.SingleTagSectionHandler"/>
</sectionGroup>
</configSections>
<API>
<loginURL url="http://test.fr:81/api/sm?" param1="name=" param2="&password="/>
</API>
推荐阅读
- r - 是否有可以在 R 中找到特定站点的服务器时间的编码?
- unity3d - 2D 盒子碰撞器在 Unity 中不起作用
- php - phpMyAdmin sql 查询总是返回 500 内部错误?
- python - 如何在 Robot Framework-SeleniumLibrary 中获取多个元素并打印?
- php - 根据搜索条件创建一个新的数组形式的多维数组
- ios - 从Nsnumber转换为数据发送rssi到蓝牙模块IOS swift 4
- swift - 一对 DatePickers SwiftUI
- javascript - 在 tensorflow.js 中使用 ip-camera
- javascript - 如何为给定的输出编写逻辑?
- c++ - 为什么有析构函数会使类不可复制?