无法在appsetting.config中定义键值 [英] Not able to define key value in appsetting.config
本文介绍了无法在appsetting.config中定义键值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
向键添加值时出错。
< add key =RedirectionPgevalue =https://测试。 aspx?sourcedoc = {Test}& file = Process.docx& action = default/>
实体文件没有定义
实体动作未定义
如何将这两个单词视为字符串并添加它的价值。
谢谢
我尝试了什么:
尝试添加'文件'但没有成功
解决方案
你需要编码重定向之前的URL。
错误显示是因为它考虑了&作为查询字符串分隔符,因此将file视为另一个查询字符串变量。
等同于&的UTF-8是%26,=是%3D。
查看以下教程了解详细信息 -
HTML网址编码参考 [ ^ ]
在Javascript中你可以使用
- JavaScript encodeURI()函数 [ ^ ]
- JavaScript decodeURI()函数 [ ^ ]
对于ASP.Net检查 -
- HttpServerUtility.UrlEncode Method(String)(System.Web) [ ^ ]
希望,它有帮助:)
使用amp;之后&价值网址
< add key = RedirectionPge value = https://Test.aspx?sourcedoc = {Test}& amp; file = Process.docx& amp; action =默认 / >
使用amp;之后&
< 添加 key = RedirectionPge value = https://Test.aspx?sourcedoc = {Test}& amp; file = Process.docx& amp; action = default / >
Getting error while adding values to key.
<add key="RedirectionPge" value="https://Test.aspx?sourcedoc={Test}&file=Process.docx&action=default" />
Entity "File" not defined
Entity "Action" not defined
How can i treat this two word as string and add it to value.
Thanks
What I have tried:
Tried with adding "'"File"'" but not succeded
解决方案
You need to encode the URL prior to redirect.
The error is showing because it considers the "&" as query string separator and thus treats "file" as another query string variable.
The UTF-8 equivalent of "&" is "%26" and that of "=" is "%3D".
Check following tutorial for detailed information-
HTML URL Encoding Reference[^]
In Javascript you can make use of
- JavaScript encodeURI() Function[^]
- JavaScript decodeURI() Function[^]
For ASP.Net check-
- HttpServerUtility.UrlEncode Method (String) (System.Web)[^]
Hope, it helps :)
Use "amp;" after & in value url
<add key="RedirectionPge" value="https://Test.aspx?sourcedoc={Test}&file=Process.docx&action=default" />
Use "amp;" after &
<add key="RedirectionPge" value="https://Test.aspx?sourcedoc={Test}&file=Process.docx&action=default" />
这篇关于无法在appsetting.config中定义键值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文