This is the check for network connectivity (in .NET 2.0):
System.Net.NetworkInformation.NetworkInterface.Get IsNetworkAvailable();
This will tell you only if you are connected to something (network, dialup,
wireless etc), not whether the internet is contactable. The best bet is to
try and do what you want to do and handle any exceptions, or try and open
something like google for microsoft to check for connectivity.
HTH
Ciaran O'Donnell
"Peter Thornqvist" wrote:
Is there an equivalent to InternetCheckConnection in .Net? If not, why not
interop it?
Here's another alternative:
using System.Net;
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(@"http://www.microsoft.com");
An exception indicates that the site isn't reachable thus probably there is
no internet connection (ms site could be down as well, but that is not as
probable).
--
Regards, Peter
"Michael Nemtsev" <ne*****@msn.comskrev i meddelandet
news:17***************************@msnews.microsof t.com...
Hello perspolis,
Google first
http://groups.google.com/groups/sear...check+internet, as well as
http://www.codeguru.com/Cpp/I-N/inte...icle.php/c3437
sample
pHi all
pHow can I find that user is connected to internet or not?
pthanks in advance
p---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour
"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche