Click to See Complete Forum and Search --> : [2.0] Checking if a website / web page exists?
sciguyryan
May 17th, 2006, 03:23 PM
Hi all!
Does anyone have a way to check if a web page / website exists? Right now I'm simply catching the error that results when it does not but I'm wondering if there is a way to simply check that the page exists before trying to access it at all.
Cheers,
Ryan Jones
wossname
May 17th, 2006, 04:22 PM
You could send a "HEAD" request to the server. Google should have loads of info about how to do this.
You could do it with an HTTPWebRequest object.
Then you check the stream that the server sends back if the first line contains "200" then you are in business, if you get a "404" instead you know what that means :D
sciguyryan
May 17th, 2006, 05:13 PM
You could send a "HEAD" request to the server. Google should have loads of info about how to do this.
You could do it with an HTTPWebRequest object.
Then you check the stream that the server sends back if the first line contains "200" then you are in business, if you get a "404" instead you know what that means :D
Hmm, I will try the second one first and if that fails then I'll try the first - thanks :)
Cheers,
Ryan Jones
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.