Check for active Internet connection..not working?!?

  • Thread starter Thread starter Alfa & Omega
  • Start date Start date
A

Alfa & Omega

I found this example but when it comes to:

Resp = WebReq.GetResponse();

It jus freezes my application??

<CODE>
public static bool IsConnected()
{
System.Uri Url = new System.Uri("http://www.microsoft.com");

System.Net.WebRequest WebReq;
System.Net.WebResponse Resp;
WebReq = System.Net.WebRequest.Create(Url);

try
{
Resp = WebReq.GetResponse();
Resp.Close();
WebReq = null;
return true;
}

catch
{
WebReq = null;
return false;
}
}</CODE>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top