从 URL 查询字符串中读取特殊字符
我遇到的情况是,用户可以在 URL 查询字符串中输入他们想要的任何字符。
示例:
http://localhost/default.aspx?ID=a‡jljglkjg
我如何接受ASP.NET 中 URL 查询字符串中的特殊字符,例如 ‡、ˆ 和 †?我发现当我尝试检索这些 URL 查询字符串时,这些特殊字符会被替换为“?”。
注意:用户将这些查询字符串输入到 URL 中。
I have a situation where the user is able to enter any characters they want in a URL query string.
Example:
http://localhost/default.aspx?ID=a‡jljglkjg
How can I accept special characters such as ‡, ˆ, and † in asp.net from a URL query string? I am finding that when I attempt to retrieve these URL query string these special characters gets replaced with a “?”.
Note: The user inputs these query string into the URL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据 RFC,此 URL 错误。
encodeURIcomponent
HttpUtility.UrlEncode
此处This URL is wrong according to RFC.
encodeURIcomponent
HttpUtility.UrlEncode
here这些角色将永远被排除在外,你需要找到另一种方法来做到这一点。
Those characters will always be excluded, you need to find another way to do it.
有关详细信息,请参阅 http://www.w3schools.com/tags/ref_urlencode.asp关于有效 URL 和特殊字符编码。
See http://www.w3schools.com/tags/ref_urlencode.asp for more information about valid URLs and encoding special characters.