zoukankan
html css js c++ java
web.config中特殊字符的处理
在ASP.NET应用中通常需要将数据库用户名和密码写在web.config中(当然也可以直接编译到dll中,增加安全性,但不够灵活修改数据库或使用数据源控件时会有问题)。在这过程中通常会遇到这样一个问题:明明用户明和密码都正确,但数据库却始终无法连接。这是因为数据库密码通常会出现特殊字符像“<”,“>”,“&”等等。这就造成了异常。
解决办法
1.使用"
<![CDATA[
" 标记开始,以"
]]>
"标记结束,所有在CDATA部件之间的文本都会被解析器忽略。CDATA部件之间不能再包含CDATA部件(不能嵌套)。如果CDATA部件包含了字符"]]>" 或者"<![CDATA[" ,将很有可能出错。
2.使用转义字符
<
<
小于号
>
>
大于号
&
&
和
'
'
单引号
"
"
双引号
不知道特殊字符的转义字符怎么写?不要紧,打开DW或VS等编辑工具,设计视图输入要转义的字符,然后切换到代码视图,这便得到了它们的转义字符。
复制到web.config密码位置,问题解决!
查看全文
相关阅读:
harbor 报错,注意harbor.yml文件格式。
nginx中rewrite文件
改善github网络连接
代码层实现六种质量属性战术
读漫谈架构有感
“淘宝网”的六个质量属性的六个常见属性
寒假学习进度16:tensorflow2.0 波士顿房价预测
寒假学习进度15:tensorflow2.0 优化器
寒假学习进度14:对mnist数据集实现逻辑回归
寒假学习进度13:tensorflow2.0 mnist简介
原文地址:https://www.cnblogs.com/AlexCheng/p/2120260.html
最新文章
2021.4.12
2021.4.11每日学习
2021.4.10每日学习
质量属性小论文
以《淘宝网》为例,描绘质量属性的六个常见属性场景
寒假自学2.10
寒假自学2.09
寒假自学2.08
2021上第十五周学习记录
2021上第十四周学习记录
热门文章
2021上第十二周学习记录
构建之法读书记录——2
2021上第十周学习记录
构建之法读书记录——1
2021上第九周学习记录
2021上第八周学习记录
架构漫谈读书笔记——1
2021下第六周学习记录
Alpha 冲刺(3/6)
Alpha冲刺(2/6)
Copyright © 2011-2022 走看看