【发布时间】:2016-12-31 02:27:28
【问题描述】:
我想在 C# 中发送一个 POST 请求,我需要通过以下方式发送以下内容
"jsonrpc": "2.0",
"id": "12345",
"method": "my method",
"params": {
"api_key": "my api key",
"preset_id": "my preset id"
}
我尝试过使用
using (WebClient client = new WebClient ())
{
byte [] response =
client.UploadValues ("my url", new NameValueCollection ()
{
{ "jsonrpc", "2.0" },
{ "id", "12345"},
{ "method", "my method"},
{ "params", ""}
});
string result = System.Text.Encoding.UTF8.GetString (response);
}
但我无法将参数设为数组,请帮忙,谢谢
【问题讨论】:
-
@CodingYoshi 不完全是,我的问题来自我可以让参数成为数组的事实。而且您发布的解决方案也不使用数组。感谢您的尝试