Internet connection

Hi!
How may I check if the system is connected to the internet, through a VB .NET Windows Application?

Regards!
M.Sadegh Samiei

[150 byte] By [samiei] at [2007-12-16]
# 1
Hi,

You can use the API function InternetCheckConnection to achieve this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetcheckconnection.asp

Sample Code below:
http://www.mentalis.org/apilist/7BA2919B3CC7864AD0BE3278CCFA56E7.html

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
Hi

I don't like linking to dll's as this causes no end of deloyment headaches + security exception issues.

This works in c#

using System.Net;

HttpWebRequest request = (HttpWebRequest)WebRequest.Create( url );

You simply get exceptions when Create is called.

It's part of the framework and requires no horrible external dll calls.

AlanSimes at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified