[2.0] Checking if a website / web page exists?
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
Re: [2.0] Checking if a website / web page exists?
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
Re: [2.0] Checking if a website / web page exists?
Quote:
Originally Posted by wossname
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