using System.Net;
WebRequest objWebReq;
WebResponse objResp;
public Boolean IsConnectionAvailable()
{
System.Uri objUrl = new System.Uri("http://www.google.com/");
objWebReq = WebRequest.Create(objUrl);
try
{
objResp = objWebReq.GetResponse();
objResp.Close();
objWebReq = null;
return true;
}
catch (Exception ex)
{
objResp.Close();
objWebReq = null;
return false;
}
}
No comments:
Post a Comment