Hi, thanks, that works, but not 100% as should. And how can I ping the url?
I have another code:
string url = "https://www.#####.com/test.php";
string postData = "key=value&test=1";
// converting string to bytes for stream
byte postDataStream = Encoding.UTF8.GetBytes(postData);
WebRequest request = WebRequest.Create(url);
request.Method = "POST";
request.ContentLength = postDataStream.Length;
request.ContentType = "application/x-www-form-urlencoded";
// writing post data to request stream
Stream dataStream = request.GetRequestStream();
dataStream.Write(postDataStream, 0, postDataStream.Length);
// fetching response
WebResponse webResponse = request.GetResponse();
Stream webStream = webResponse.GetResponseStream();
// if response is to big, we need to read is as stream
StreamReader reader = new StreamReader(webStream);
string data = reader.ReadToEnd();
catch (Exception ex)
await DisplayAlert("ex", "" + ex, "OK");
This code works only for specific website, so I suppose, some hostings are some firewalls or something, what blocking this curl post. Simply - I try two URL (two different hosting providers) - one work / another not. Hosting providers can´t help me withou some errors.
So my new question is - can someone help me, how to show error message? I already have this code in try / catch but I dont get any errors. When I run this code, whole app frozen.