从 URL 查询字符串中读取特殊字符

发布于 2024-11-25 02:18:00 字数 293 浏览 4 评论 0原文

我遇到的情况是,用户可以在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我很OK 2024-12-02 02:18:00

根据 RFC,此 URL 错误

  • 如果他们使用浏览器,它通常会执行所需的执行
  • 如果是由 JavaScript 完成,请使用 encodeURIcomponent
  • 如果是 C# 应用程序,请使用 HttpUtility.UrlEncode 此处

This URL is wrong according to RFC.

  • If they are using browser, it would normally do the ecndoing required.
  • If it is done by JavaScript, use encodeURIcomponent
  • If it is a C# app, using HttpUtility.UrlEncode here
怎言笑 2024-12-02 02:18:00

URL 只能使用 ASCII 字符集通过 Internet 发送。

这些角色将永远被排除在外,你需要找到另一种方法来做到这一点。

URLs can only be sent over the Internet using the ASCII character-set.

Those characters will always be excluded, you need to find another way to do it.

写下不归期 2024-12-02 02:18:00

有关详细信息,请参阅 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文