01.Blogs :
payat  

Verifying net connectivity in C#

I really need help if anyoen out there who can help me please do.

I'm trying to find out how to verify internet connectivity in C#. I've tried using the WebResponce.getRequest() it will work if I'm online, but once I'm offline the application will hang if I reach that code. I was hoping that it will throw and exception but it doesn't it just freezes there.

posted on Saturday, December 10, 2005 11:38 PM by payat

# re: Verifying net connectivity in C# @ Saturday, December 10, 2005 7:00 PM

There is a easy way to do it in VB 2005, I'm quite sure there is a way to do it in C#, just need to dig harder. But what you can do is take the VB code, convert it into a library (.dll) and import it into your C# project and call for the method. It is just a suggestion, it's 7.57am, a bit early so my ideas can be a bit crazy too.

In VB

Dim pingResult as Boolean = My.Computer.Network.Ping ("http://thespoke.net")
If pingResult = True Then
Messagebox.Show("The site is up!")
Else
Messagebox.Show("The site is down!")

HTH

Bernard

# re: Verifying net connectivity in C# @ Sunday, December 11, 2005 1:35 AM

@Bernard
I've heard there is a ping mehtod in VS 2005, but I'm using VS 2003. Is there any way I can do this in VS 2003

payat


 
03.UPDATE CALENDAR :
<December 2005>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

05.MY LINKS :

07.Subscriptions :

Subscriptions


© Copyright 2005 Microsoft Corporation. All Rights Reserved.
Terms of Use | Privacy Statement | Code of Conduct | Hosted by MaximumASP for Microsoft
WHO-BAR