Using Microsoft Internet Controls
Hi EveryBody:
As we know in classic vb we can use win32 api functions to check if the
computer connected to the internet or not.And also to connect to the internet.
My question is Can I Check the connection to the internet or I connect to
the internet in Vb.Net by adding Microsoft Internet Controls as reffrance to
my project instaed of using win32 api ?
If yes how can I do that ?
Any help or redirection will be appreciated
regard's
Husam
[515 byte] By [
HusamMc] at [2007-11-11 7:40:00]

# 1 Re: Using Microsoft Internet Controls
I would recommend using the classes in the System.Net namespace rather than the Microsoft Internet Controls. You could, for example, do something like this:
Public Shared Function GotInternet() As Boolean
Dim req As HttpWebRequest
Dim res As HttpWebResponse
Try
req = CType(WebRequest.Create("http://www.google.com"), _
HttpWebRequest)
res = CType(req.GetResponse(), HttpWebResponse)
req.Abort()
If res.StatusCode = HttpStatusCode.OK Then
GotInternet = True
End If
Catch weberrt As WebException
GotInternet = False
Catch except As Exception
GotInternet = False
End Try
End Function