Do not use; intended only for browser compatibility. Use UrlEncode.
UrlEncode不会这样做,它为URL的参数部分编码字符串,而不是路径部分.有没有更好的方法来编码路径部分的字符串,为什么我不应该使用这个函数,这是在1.1以后的框架中工作?
解决方法
You can encode a URL using with the UrlEncode method or the UrlPathEncode method. However,the methods return different results. The UrlEncode method converts each space character to a plus character (+). The UrlPathEncode method converts each space character into the string “%20”,which represents a space in hexadecimal notation. Use the UrlPathEncode method when you encode the path portion of a URL in order to guarantee a consistent decoded URL,regardless of which platform or browser performs the decoding.
UrlEncode也使用UTF-8编码,因此如果您使用不同语言(如阿拉伯语)发送查询字符串,则应使用UrlEncode
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。