Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to check for 404

Status
Not open for further replies.

GlennBSI

Programmer
Mar 27, 2001
77
US
Does anyone have a sample of how to check if a page exists (or if the server is up) from code?

I have a page that needs to check (from server side asp code) if another page is available and if it doesn't to do some process (and not redirect to the page, because it isn't available).

I think I've seen a sample of this here (I know I've seen similar questions posted), but I can't seem to find it using the search tool.

Thanks in advance for any help!!
Glenn
 
if the page is on your website, use the FSO to check for the existance of the file.

if it's on a separate site, you need to implement an http page scraper, pull the page from the component, and parse that page. I can't tell you off hand of a good http screen tear component, but you should be able to find one at hth
leo

------------
Leo Mendoza
lmendoza@students.depaul.edu
 
If you have admin privelages on your web server, you can set up your own custom error pages, which you could point to a specific asp page which would do this processing, and then redirect them back where they came from, or to wherever you like...

It's under the website properties --> custom error messages in your IIS management console.

You can pick one for each type of error if you like.
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top