You can use the HttpWebRequest object to call a simple page on site http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfsystemnethttpwebrequestclasstopic.asp
Set a short timeout when you create it (otherwise you will wait for a while if it is not up). If the request times out, the site is down. If you get an HttpWebResponse object, the site might be up. Check the status code on the response. If it is 200, the site is returned the page normally and the site is at least serving. HTH, Dean Fiala ----------------------------- Very Practical Software, Inc. http://www.vpsw.com/links.aspx -----Original Message----- From: DJ Spiess [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 6:58 PM To: [EMAIL PROTECTED] Subject: [AspNetAnyQuestionIsOk] Testing if a website is up? This might be easy... How do I test if a website is up? I want to redirect to another website if it is up, otherwise I'll redirect to a default website. I need to collect information from the user, but if the collection page is down for any reason, I need to let them continue on to a web application. The collection resides on a different server from where we determine this. I have this in the OnLoad of a page if (PingCollectWeb()) { Response.Redirect(collectUrl + formattedQuery, false); } else { // skip for now since the site is down Response.Redirect(newTarget, true); } but I'm uncertain how to actually ping the server. Thanks, Daniel Spiess Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511 http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/saFolB/TM ---------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
