PC Review


Reply
Thread Tools Rate Thread

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

 
 
Alfa & Omega
Guest
Posts: n/a
 
      29th Aug 2006
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>


 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      29th Aug 2006
How about setting the TimeOut property on your WebRequest?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Alfa & Omega" wrote:

> 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>
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to check wheather active sync connection or any connection is there(gprs,wlan) raghu Microsoft Dot NET Compact Framework 1 23rd Sep 2005 05:59 PM
help Active Internet Connection icon gone! =?Utf-8?B?ZGV2aWxzc3RvbmU=?= Windows XP Help 3 20th Jan 2005 01:07 PM
checking for active internet connection =?Utf-8?B?U3RlcGhlbg==?= Microsoft Dot NET 0 28th Oct 2004 03:05 PM
active internet connection chose phillips Windows XP Networking 1 6th Jul 2004 11:37 PM
Re: Active X and Internet Connection Problems Kaylene aka Taurarian Windows XP Help 0 11th Mar 2004 09:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:41 PM.