Re: Checking if a website is online from a windows app
- From: MarkusJNZ@xxxxxxxxx
- Date: Wed, 01 Aug 2007 23:53:04 -0700
On Aug 2, 4:17 pm, Peter Duniho <NpOeStPe...@xxxxxxxxxxxxxxxx> wrote:
Markus...@xxxxxxxxx wrote:
Hi Pete, a 404 error is fine but I am not sure if a 404 will return a
string length > 0(?) from the webrequest. If so checking the sring
length would fail even though the website was still alive.
Why does it matter? If you get a 404 error, then that itself tells you
the information you want to know. Why would you care about any data
past the error response, even if it exists?
This post was to ask if I am doing things the right way or if someone
can recommend a better way to do things.
Well, I would agree that simply checking the length of the response
isn't an appropriate solution.
For all I know there may have been an obscure method buried deep in
the .NET 2.0 framework which did what I am going to do manually :)
I don't have any first-hand experience with the HttpWebRequest class,
but it looks to me as though if any HTTP error occurs when you call
GetResponse(), a WebException will be thrown. You can look at the
Response property of the WebException to see the details of the error,
but in your case the mere fact that the exception is thrown would
probably suffice.
Are you finding that you have a situation when the web site is not
available and yet an exception is not thrown when you call GetResponse()?
Pete
Hi Pete, I'll give it a whirl and see how I go. Thanks again for your
help
Regards
Markus
.
- References:
- Checking if a website is online from a windows app
- From: MarkusJNZ
- Re: Checking if a website is online from a windows app
- From: Peter Duniho
- Re: Checking if a website is online from a windows app
- From: MarkusJNZ
- Re: Checking if a website is online from a windows app
- From: Peter Duniho
- Re: Checking if a website is online from a windows app
- From: MarkusJNZ
- Re: Checking if a website is online from a windows app
- From: Peter Duniho
- Checking if a website is online from a windows app
- Prev by Date: Re: How to limit program can only run one instance.
- Next by Date: I have an important comment on that
- Previous by thread: Re: Checking if a website is online from a windows app
- Next by thread: Re: MDI parent w/ transparent background. possible?
- Index(es):
Relevant Pages
|