我想与具有相同名称的许多参数发送POST请求:发送POST请求与参数在C#中的同名
FormUrlEncodedContent content = new FormUrlEncodedContent(new [] {
new KeyValuePair < string, string > ("group_id", "344"),
new KeyValuePair < string, string > ("group_id", "20"),
new KeyValuePair < string, string > ("group_id", "456")
});
HttpResponseMessage response = await _httpClient.PostAsync("http://localhost/api", content);
但是,如果使用上述要求我只得到了第一个GROUP_ID响应( 344 ID)。你有什么想法我可以获得“group_id [] = 344 & group_id [] = 20 & group_id [] = 456”使用FormUrlEncodedContent?
您是否尝试过通过GROUP_ID关键和像这样的数组值[344,20,456]? – 2014-10-12 15:11:47
我想是这样: 'FormUrlEncodedContent含量=新FormUrlEncodedContent(新[] { 新KeyValuePair <字符串,字符串[]>( “GROUP_ID”,新的字符串[] { “344”, “20”}) });' 但是,我得到的错误: 1. _最好的重载方法匹配'System.Net.Http.FormUrlEncodedContent.FormUrlEncodedContent(System.Collections.Generic.IEnumerable>)'有一些无效参数_ –
pbalut
2014-10-12 16:58:02