Results 1 to 3 of 3

Thread: Internet Connection!!!

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Lebanon,Beirut
    Posts
    48

    Internet Connection!!!

    Hi there;
    i need a code that tests if an internet connection is active via Modem or Network!!! in VB .net

    any ideas?

    Thank you
    There is,we are,abou il zoulouf,mijana w mal3ona

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  3. #3
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Originally posted by Pirate
    See if this would help : http://www.vb2themax.com/Item.asp?Pa...at=1701&ID=588
    That code assumes that you have WMI installed on the computer. WMI is not installed by default on Windows 98, so that code would fail on Windows98.
    Try this
    VB Code:
    1. Public Shared Function GotInternet() As Boolean
    2.         Dim req As HttpWebRequest
    3.         Dim res As HttpWebResponse
    4.         Try
    5.             req = CType(WebRequest.Create("http://www.devbuzz.com"), HttpWebRequest)
    6.             res = CType(req.GetResponse(), HttpWebResponse)
    7.             req.Abort()
    8.             If res.StatusCode = HttpStatusCode.OK Then
    9.                 GotInternet = True
    10.             End If
    11.         Catch weberrt As WebException
    12.             GotInternet = False
    13.         Catch except As Exception
    14.             GotInternet = False
    15.         End Try
    16. End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width