向服务器发送文件的简单请求出现了一些问题,这是网址,
https://dc2-vault.myvzw.com/dv/api/user/c107a6db69104a10bc247a28fb81131e/search?query=contentType:audio/ * AND(类型类似于'RoyalJatt.Com)')&sort = name + asc&start = 1&count = 2147483647
然后我这样做
url = Uri.EscapeUriString(url);
我明白了
https://dc2-vault.myvzw.com/dv/api/user/c107a6db69104a10bc247a28fb81131e/search?query=contentType:audio/ *%20AND%20(genre%20like%20'RoyalJatt.Com%20)')&sort =名称+ asc&start = 1&count = 2147483647
这里的问题是
该查询将查找包含Genre RoyalJatt.Com%20)的文件,该文件本应为RoyalJatt.Com%20%29
由于某种原因,它省略了“)”
我该怎么做才能解决此问题?
这就是我所做的并使其正常工作。
private readonly static string reservedCharacters = "!*'();:@&=+$,/?%#[]";` //Neither of Uri.EscapeUriString and Uri.EscapeDataString methods encodes //the RFC 2396 unreserved characters If you need these encoded then you //will have to manually encode them public static string UrlEncode(string value) { if (String.IsNullOrEmpty(value)) return String.Empty; var sb = new StringBuilder(); foreach (char @char in value) { if (reservedCharacters.IndexOf(@char) == -1) sb.Append(@char); else sb.AppendFormat("%{0:X2}", (int)@char); } return sb.ToString(); }
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句