我想與具有相同名稱的許多參數發送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