I have class in c# which makes POST call to a REST API. BUt it gives me a 'connection time out' error with error code as 10060. In the POST call I am trying to make some transaction adjustments in the client's system. When I use Fiddler or Postman to make the api call, the request seems to go through but not from the c# class. Can you see where I am going wrong? Below is my sample code.
HttpWebRequest request = (HttpWebRequest)WebRequest.CreateHttp(clientURL);
byte[] data = Encoding.UTF8.GetBytes(urlParameters);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (Stream stream = request.GetRequestStream()) **//exception occurs at this point**
{
stream.Write(data, 0, data.Length);
}
Thanks.