473,788 Members | 2,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine if a page is up or down.

We have a site, for reference I'll call this MainSite,
that has certain pages actually hosted on another site,
I'll call this ChildSite. In MainSite when you click on a
certain link, it loads a page with an IFrame that points
to a page in ChildSite. MainSite and ChildSite are on two
different machines. If MainSite can "see" ChildSite,
everything works like a champ. However, if there is a
network problem, firewall issue, or something else wrong
with "seeing" the ChildSite, the users in MainSite get
an "Action Cancelled" error. It's totally confusing to
receive that error and we're trying to come up with a way
around it.

What I want to do is check the availability of that page
in ChildSite before the IFrame starts its request. I have
some code that works fine under good conditions, here's
the basic concept:

HttpWebRequest request = (HttpWebRequest )WebRequest.Cre ate
(url);
HttpWebResponse response = (HttpWebRespons e)
request.GetResp onse();
Console.WriteLi ne(response.Sta tusCode);

....basically i want to check and see if the response
status is OK(aka 200). My concern is this, usually if
there is a connectivity problem, the page will sit there
for up to 15 seconds before it displays a message
indicating the problem. If the page is up, it will
display in maybe one second, it's a very lite page with
very little to display or process. I need to know if I
should load up a worker thread to test for the web page
status, and then in a watcher thread, determine if after
say 2 seconds, if i haven't received an OK status, that
it's safe to say the page is down so kill the worker
thread. Or, can I rely on the HttpWebRequest to return a
status quickly enough to determine page status?

Or does anyone have a different but reliable solution for
checking the status of a web page?
Nov 18 '05 #1
2 1574
you approach will work for most cases, but only if connectivity is down
between your site and the child site. it may be down for the user to child,
but ok for your site. you don't need a seperate thread, unless you just want
to poll and set a status, just reduce the timeout. polling would lead to
false ok's just when the site goes down.

another common approach is for your main site could proxy the child site.
your site translates the url to a local site and fetches the pages. you can
do this with a filter.

-- bruce (sqlwork.com)
"Chris Carter" <ch***@panterav b.com> wrote in message
news:09******** *************** *****@phx.gbl.. .
We have a site, for reference I'll call this MainSite,
that has certain pages actually hosted on another site,
I'll call this ChildSite. In MainSite when you click on a
certain link, it loads a page with an IFrame that points
to a page in ChildSite. MainSite and ChildSite are on two
different machines. If MainSite can "see" ChildSite,
everything works like a champ. However, if there is a
network problem, firewall issue, or something else wrong
with "seeing" the ChildSite, the users in MainSite get
an "Action Cancelled" error. It's totally confusing to
receive that error and we're trying to come up with a way
around it.

What I want to do is check the availability of that page
in ChildSite before the IFrame starts its request. I have
some code that works fine under good conditions, here's
the basic concept:

HttpWebRequest request = (HttpWebRequest )WebRequest.Cre ate
(url);
HttpWebResponse response = (HttpWebRespons e)
request.GetResp onse();
Console.WriteLi ne(response.Sta tusCode);

...basically i want to check and see if the response
status is OK(aka 200). My concern is this, usually if
there is a connectivity problem, the page will sit there
for up to 15 seconds before it displays a message
indicating the problem. If the page is up, it will
display in maybe one second, it's a very lite page with
very little to display or process. I need to know if I
should load up a worker thread to test for the web page
status, and then in a watcher thread, determine if after
say 2 seconds, if i haven't received an OK status, that
it's safe to say the page is down so kill the worker
thread. Or, can I rely on the HttpWebRequest to return a
status quickly enough to determine page status?

Or does anyone have a different but reliable solution for
checking the status of a web page?

Nov 18 '05 #2
Thanks for the response Bruce, I'll look into the proxy
suggestion. I like the idea of just testing whether the
main site can see the child site by getting back an OK
status. It's really just to shorten the timeout like you
mentioned and possibly give us a chance to throw up a
slightly friendlier "home grown" error page that makes it
_look_ like we have everything covered. Thanks again.
-chris

-----Original Message-----
you approach will work for most cases, but only if connectivity is downbetween your site and the child site. it may be down for the user to child,but ok for your site. you don't need a seperate thread, unless you just wantto poll and set a status, just reduce the timeout. polling would lead tofalse ok's just when the site goes down.

another common approach is for your main site could proxy the child site.your site translates the url to a local site and fetches the pages. you cando this with a filter.

-- bruce (sqlwork.com)
"Chris Carter" <ch***@panterav b.com> wrote in message
news:09******* *************** ******@phx.gbl. ..
We have a site, for reference I'll call this MainSite,
that has certain pages actually hosted on another site,
I'll call this ChildSite. In MainSite when you click on a certain link, it loads a page with an IFrame that points
to a page in ChildSite. MainSite and ChildSite are on two different machines. If MainSite can "see" ChildSite,
everything works like a champ. However, if there is a
network problem, firewall issue, or something else wrong
with "seeing" the ChildSite, the users in MainSite get
an "Action Cancelled" error. It's totally confusing to
receive that error and we're trying to come up with a way around it.

What I want to do is check the availability of that page
in ChildSite before the IFrame starts its request. I have some code that works fine under good conditions, here's
the basic concept:

HttpWebRequest request = (HttpWebRequest ) WebRequest.Crea te (url);
HttpWebResponse response = (HttpWebRespons e)
request.GetResp onse();
Console.WriteLi ne(response.Sta tusCode);

...basically i want to check and see if the response
status is OK(aka 200). My concern is this, usually if
there is a connectivity problem, the page will sit there
for up to 15 seconds before it displays a message
indicating the problem. If the page is up, it will
display in maybe one second, it's a very lite page with
very little to display or process. I need to know if I
should load up a worker thread to test for the web page
status, and then in a watcher thread, determine if after
say 2 seconds, if i haven't received an OK status, that
it's safe to say the page is down so kill the worker
thread. Or, can I rely on the HttpWebRequest to return a status quickly enough to determine page status?

Or does anyone have a different but reliable solution for checking the status of a web page?

.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1916
by: Web Webon | last post by:
Hi everybody! I wonder if this is possible? I need to determine if a client is using "windows classic folders" or anything else. If I instantiate a Shell ActiveX object is there a way of obtaining this information from javascript? (I know that the user will get prompted about allowing such an operation, but I am willing to live with this). Because of the way one of my pages work, I need to know this information in order to "cover up"...
88
12560
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
9
19534
by: Adam | last post by:
Can someone please help!! I am trying to figure out what a font is? Assume I am working with a fixed font say Courier 10 point font Question 1: What does this mean 10 point font Question 2: How do I determine how many characters I can get on a line Question 3: How do I determine how many lines I can get on a page. Assume no margins Question 4: Does their exist some kind of refernce table that will equate a font with chars/line and...
2
7079
by: NewsAccount | last post by:
Hi I'm trying to find a way to programmatically measure the size of the page sent down to the browser, can't seem to measure the length of what gets written to the HTML TextWriter in protected override void Render(HtmlTextWriter writer) {
2
1502
by: mykidisgollum | last post by:
Greetings, We've recently been working with our site pages' viewstate, turning off unnecessesary viestate items to reduce page size for faster loading. We are also experimenting with using less tables etc. What is the best way to determine the amount of data passed from server to client in an ASP.NET page run? Right now the only way we know is to view source, save source and view the file size properties. I believe this may not...
3
11589
by: Developer in California | last post by:
I am working on developing a generic Web framework using Master Pages in ASP.NET 2.0. What I have done is created a PageRenderer class which has a public method which will retrieve the path of the content I want to execute based on the name of the asp:Content control. As shown in the code snippet below, to get the content I want to display, I call the GetContentPagePath public method in PageRenderer passing a string duplicating the value...
1
1791
by: DBxGlock | last post by:
Howdy folks, Recently we copied a .NET 1.1 aspx page and dll to a production server. The page had a web reference to a service that we have running on the production server, as well as another version running on the test server. Everything ran fine in production until the test server went down, and we noticed that the page that was put on the production machine had its web reference pointing to the web service on the test machine. Is...
4
2853
Sandboxer
by: Sandboxer | last post by:
I want to be able to program Access to provide for me, by individual day, what my contract obligations are to my customers. Will Access recognize all the individual days in between a date range (simply a "from" date and a "to" date)? Additionally, I need to delivery a specific quantity of product when the customer's inventory is within about parameter levels. EXAMPLE: "During the Date Range January 1, 2010 through April 30, 2010 when...
6
1331
by: Alexander Vasilevsky | last post by:
How do you determine (on the client, on the server) that the visitor leave the site? http://www.alvas.net - Audio tools for C# and VB.Net developers
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10370
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10113
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5402
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2896
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.