The following code returns true for wifi connection but false while checking for cellular(wwan) network on device , here is the code
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.google.com");
request.Timeout = 25000;
request.Credentials = CredentialCache.DefaultNetworkCredentials;
request.UseDefaultCredentials=true;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
return response.StatusCode == HttpStatusCode.OK;
}
catch (Exception e)
{
return false;
}
i am getting the error as
The remote server returned an error: (403) Forbidden
help out.
Check out Xamarin Reachability class here.
Edit:
Download and install the vodafone profile from http://db.tt/SqQGQ9Ci