我想将用户重定向到这个地址(POST 并且没有表单):
example.com/save
数据:
userId: 12
result: 95.7
行动:
[HttpGet]
public IActionResult Save()
{
// here code
}
我想将用户重定向到这个地址(POST 并且没有表单):
example.com/save
数据:
userId: 12
result: 95.7
行动:
[HttpGet]
public IActionResult Save()
{
// here code
}
使用 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);
}