Page 1 of 2

Dead Link Checker

Posted: Wed Sep 08, 2010 3:38 pm
by Adroxxx
Is someone able to make a dead link checker? hehaho;

Re: Dead Link Checker

Posted: Wed Sep 08, 2010 3:56 pm
by bisnes_niko
Well, I use

On load;
Code: Select all
If CheckLink("www.hastalavistababytrolollthiswebsiteshouldnotbeexisting.com/super.html") = False then : msgbox("This link is dead ;(") : Else : Msgbox("This link isn't dead! hurray")
and add this code piece inside the Public Class Form1, end class
Code: Select all
Private Function CheckLink(ByVal Address as String) as Boolean
Try
my.computer.network.ping(Address)
catch ex as exception
Return False
end try
return true
End function
YES, fixed D:

Re: Dead Link Checker

Posted: Wed Sep 08, 2010 3:58 pm
by Axel
kinda good idea i made a library a while ago but i quitted vb :D this would be a good idea for a library...

Re: Dead Link Checker

Posted: Wed Sep 08, 2010 4:48 pm
by Adroxxx
Image

Did I do something wrong?

Re: Dead Link Checker

Posted: Wed Sep 08, 2010 4:49 pm
by Axel
Adroxxx wrote:
Image

Did I do something wrong?
you forgot the address

so you need to do "Checklink("http:/www.codenstuff.com")"
thats why i love "ByVal" :D

Re: Dead Link Checker

Posted: Wed Sep 08, 2010 4:55 pm
by bisnes_niko
Woopsie... My bad did this too fast :o

Re: Dead Link Checker

Posted: Wed Sep 08, 2010 5:05 pm
by Adroxxx
It always says that my link is dead even if my link isnt cryer;

Re: Dead Link Checker

Posted: Wed Sep 08, 2010 5:12 pm
by mandai
You don't use Ping on a HTTP URL.
Use WebClient.DownloadData, if there is an error you can catch it in an exception.

Re: Dead Link Checker

Posted: Wed Sep 08, 2010 5:13 pm
by Axel
Adroxxx wrote:
It always says that my link is dead even if my link isnt cryer;
cuz u returned true ?

maybe you should change the "try" a little bit
Code: Select all
Try 
my.network.ping(adress)
return true
catch ex as exception
Msgbox(ex.message)
return false
end try

Re: Dead Link Checker

Posted: Wed Sep 08, 2010 5:16 pm
by bisnes_niko
Things you dont want to happen, happens when you do the thing too fast :S