在c#中调用post api方法,但是,必须设置代理服务器和端口
我必须从服务器调用post方法,这迫使我使用特殊的代理服务器和端口。 我用下面的代码调用了c#中的post方法,但是现在,我找不到任何设置特殊代理的地方。 请帮帮我 非常感谢在c#中调用post api方法,但是,必须设置代理服务器和端口,c#,api,restful-url,C#,Api,Restful Url,我必须从服务器调用post方法,这迫使我使用特殊的代理服务器和端口。 我用下面的代码调用了c#中的post方法,但是现在,我找不到任何设置特殊代理的地方。 请帮帮我 非常感谢 public HttpResponseMessage Authenticate(AuthenticateDTO entity) { using (var client = new HttpClient()) { client.
public HttpResponseMessage Authenticate(AuthenticateDTO entity)
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://restapi.x.com/SuperClient/V1/APIAUTHENTICATE");
var response = client.PostAsJsonAsync("SuperClient/V1/APIAUTHENTICATE", entity).Result;
if (response.IsSuccessStatusCode)
{
Console.Write("Success");
}
else
Console.Write("Error");
}
return null;
}