[英]WCF Restful and query string with special characters
I am using WCF with Restful API. 我正在使用带有Restful API的WCF。
From client, I make a GET request with query string " http://example.com/6500/%2fSIZ7 ". 从客户端,我发出带有查询字符串“ http://example.com/6500/%2fSIZ7 ”的GET请求。
With "6500" and "%2fSIZ7" are parameters. 参数“ 6500”和“%2fSIZ7”。
But on server, I only receives value of "6500" and "SIZ17" and doesn't have special character "%2f". 但是在服务器上,我只收到“ 6500”和“ SIZ17”的值,并且没有特殊字符“%2f”。
I also try with another character, for example: "#"(encode before sending). 我也尝试使用另一个字符,例如:“#”(发送前编码)。 It is working.
这是工作。
How do we send a query string with character "/"(%2f)? 如何发送带有字符“ /”(%2f)的查询字符串?
Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format. 由于URL通常包含ASCII集之外的字符,因此必须将URL转换为有效的ASCII格式。 URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits.
URL编码将不安全的ASCII字符替换为“%”,后跟两个十六进制数字。 URLs cannot contain spaces.
网址不能包含空格。 URL encoding normally replaces a space with a plus (+) sign or with %20.
URL编码通常用加号(+)或%20代替空格。
Url encoded characters are listed at HTML URL Encoding Reference . URL编码字符在HTML URL编码参考中列出。
From above list %2F is the encoded value of forward slash(/). 从上面的列表%2F是正斜杠(/)的编码值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.