ASP.NET中的表单编码POST
目前,我正在使用POST向API发送请求。以下是代码:ASP.NET中的表单编码POST,asp.net,Asp.net,目前,我正在使用POST向API发送请求。以下是代码: byte[] response = client.UploadValues("http://myapi.com/2.2/mymethod ", "POST", new NameValueCollection() { { "parameter1", "value1"},
byte[] response = client.UploadValues("http://myapi.com/2.2/mymethod ",
"POST", new NameValueCollection()
{
{ "parameter1", "value1"},
{ "parameter2" ,"value2"}
});
但是,API需要表单编码的POST。如何使用ASP.NET触发表单编码的POST?我是否需要开发一个HTML表单界面,并且参数值需要通过表单的控件传递?您的请求类型应该是表单编码的应用程序/x-www-form-urlencoded。您能举个例子吗?您的客户端变量应该允许您设置内容类型,使用上面的设置,然后完成