HttpWebRequest req = (HttpWebRequest)WebRequest.Create(@"http://192.168.1.254:8080/api/SuperRestAPI");
req.Proxy = null;
req.Timeout = 5000;
req.Method = "POST";
req.ContentType = "text/json";
using (var streamWriter = new StreamWriter(req.GetRequestStream()))
{
string json = JsonConvert.SerializeObject(loginRequest);
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
Another far more elegant solution is setting the defaultProxy enabled parameter to false in the App.Config, as explained in the following Microsoft page :
https://docs.microsoft.com/fr-fr/dotnet/framework/configure-apps/file-schema/network/defaultproxy-element-network-settings