我正在尝试将两组值传递给webclient查询字符串中的相同参数,但是它给我错误- 如何处理同一个参数的多个值?甚至我都尝试将两个值都传递给相同的参数,但是没有用。
wc.QueryString.Add("wt", "json");
wc.QueryString.Add("fq", domain + "&fq=" + orgs); // like this , but did not work
wc.QueryString.Add("indent", "true");
The remote server returned an error: (400) Bad Request.
好像url格式不正确。如果我仅将一个值传递给fq(参数),则效果很好
using (WebClient wc = new WebClient())
{
wc.QueryString.Add("wt", "json");
wc.QueryString.Add("fq", domain);
wc.QueryString.Add("fq", orgs);
wc.QueryString.Add("indent", "true");
// This line gives error
data = wc.UploadValues(uri, "POST", wc.QueryString);
URL应该看起来像这样-
https://abc:2100/solr/select?fq=domain:MCO&fq=org:US OR org:TH&q=John
但是网址以-
开头https://abc:2100/solr/select?fq=domain:MCO,org:US OR org:TH&q=John
如何摆脱这种情况?
即使在删除逗号之后,querystring中也会出现错误的请求
https://abc:7855/solr/newnew/select?fq=domain:Compl/GPO OR domain:FIU OR domain:FIU/FCRU OR domain:MCO&fq=org:00 OR org:01 OR org:99 OR org:AF OR org:AR OR org:AT OR org:AU OR org:BE OR org:BZ OR org:CA OR org:CH OR org:CN OR org:CZ OR org:D1 OR org:D2 OR org:D3 OR org:D4 OR org:DE OR org:DK OR org:E1 OR org:E2 OR org:E3 OR org:ES OR org:FI OR org:FR OR org:GB OR org:HK OR org:HU OR org:IN OR org:IT OR org:JP OR org:LU OR org:MX OR org:NL OR org:NO OR org:NZ OR org:P1 OR org:PL OR org:RU OR org:SE OR org:SG OR org:T1 OR org:TH OR org:TW OR org:US OR org:X1 OR org:X2 OR org:Z1 OR org:Z2&wt=json&q=tom&start=0&rows=20&indent=true