I have developed an app using Xamarin.Forms cross platform app. I am using following code to check whether my server is available or not.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Timeout = 8000;
request.Method = "HEAD";
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
if (response == null || response.StatusCode != HttpStatusCode.OK)
{
return false;
}
else
{
return true;
}
}
}
catch (WebException)
{
return false;
}
Above code throwing TimeOut Exception
in our client's wifi setup, but it is working fine in our wifi. When client is using LTE, then TimeOut exception
is not happening. Even pinging Google also giving TimeOut exception.
I tried setting KeepAlive, TimeOut.Infinite and few other things given in other SO threads, related to this issue. Changed pinging code also, nothing is working.
What is going wrong here?
Anything needs to enabled in wifi settings?