I am trying to connect to an API using RestSharp however I am getting the following error:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
<ipaddress>:<port>
Code:
var client = new RestClient("https://api.infobip.com/sms/1/text/advanced");
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic " + Base64Encode());
request.AddParameter("application/json", ReturnJsonData(sms), ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
The weird thing is that code works perfect in a console application but it fails to connect in a web application. Help please.