1

我想将用户重定向到这个地址(POST 并且没有表单):

example.com/save

数据:

userId:  12
result: 95.7

行动:

[HttpGet]
public IActionResult Save()
{
   // here code
}
4

1 回答 1

0

使用 HttpClient

  using (var client = new HttpClient())
    {
        client.BaseAddress = new Uri("http://example.com");
        var content = new FormUrlEncodedContent(new[]
        {
            new KeyValuePair<string, string>("userId", "12"),
            new KeyValuePair<string, string>("result", "95.7")
        });
        await client.PostAsync("Save", content);
    }
于 2020-05-18T21:57:34.803 回答