Thanks, Guys.

It seems that one purpose of the Head method is for the validation.
I will try that sometime when I am getting to the project.
The application is downloading data from Yahoo finance, and we build
the url on the fly, most of time is working well if the url is valid,
but sometime is time consuming because of the time out waiting
period.
It won't matter that much if we download a small set data, but if we
need a lot, then it definitely an issue.  We are also implementing
some other methods to reduce the downloading time, such as building a
thread pool, instead of using one thread.


Leon

On Nov 25, 11:31 pm, "Charles A. Lopez" <[EMAIL PROTECTED]>
wrote:
> Great answer.
>
> Leon, what is your app doing?
>
>
>
> On Tue, Nov 25, 2008 at 10:39 PM, AstroDrabb <[EMAIL PROTECTED]> wrote:
> > On Tue, Nov 25, 2008 at 11:13 AM, Lianghua <[EMAIL PROTECTED]> wrote:
>
> >> I know that we can use HttpWebRequest to try to get the response, but
> >> most of time, when the URL is not available, I need wait for a timeout
> >> or 404 error.  Is there any other way to complete this?  Specially I
> >> need a quick way to do so, instead of waiting for time out?
>
> >> thanks.
>
> >> Leon
>
> > So change the timeout to a small value.  You should also use the HEAD (
> >http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html) method.
>
> > 9.4 HEAD
>
> > The HEAD method is identical to GET except that the server MUST NOT return
> > a message-body in the response. The metainformation contained in the HTTP
> > headers in response to a HEAD request SHOULD be identical to the information
> > sent in response to a GET request. This method can be used for obtaining
> > metainformation about the entity implied by the request without transferring
> > the entity-body itself.  ****This method is often used for ***testing
> > hypertext links for validity***, accessibility, and recent modification****.
>
> > The response to a HEAD request MAY be cacheable in the sense that the
> > information contained in the response MAY be used to update a previously
> > cached entity from that resource. If the new field values indicate that the
> > cached entity differs from the current entity (as would be indicated by a
> > change in Content-Length, Content-MD5, ETag or Last-Modified), then the
> > cache MUST treat the cache entry as stale.
>
> --
> Charles A. Lopez
> [EMAIL PROTECTED]
>
> Bachelor of Arts - Computer Science
> New York University
>
> Registered Microsoft Partner
>
> New York City, NY

Reply via email to