?
Solved

How to check if web page or image exists without downloading in ASP.NET

Posted on 2005-03-29
7
Medium Priority
?
174 Views
Last Modified: 2010-04-07
I need to check lots of URL's to see if the page or image that the URL points
to actually exists without downloading the actual page/file as this would be
very slow and consume lots of bandwith.

Is there a way to initiate a transfer of the page/image in chunks so that
I can check for a 404 error header so the entire page doesnt have to
be downloaded?

Thanks!
0
Comment
Question by:angelo_a
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 11

Expert Comment

by:sachiek
ID: 13650635
I could see this example
http://www.w3coder.com/contest/examples/WSHttpReq.asmx

You can have something like this webservice.
Try to load the result into some simple xml document.
Look if "404 error" message is with inside that xml.

There might be whole lot of messages too like "host not found" etc.

Pretty much tuff. But give a short   :)


Sachi
0
 

Author Comment

by:angelo_a
ID: 13650789
That's but that's just a wrapper for doing a regular GET or POST request.
This would require downloading the entire image/page to get a response.

I'm looking for a way to request the image/page at a lower level so that
I can stop the transfer once enough info has been recieved to determine
if a valid image/page was returned or a 404 page was returned. This way
only the bare minimum data is transfered. The lists of URL's I need to check
can be from 2000-10000 URL's
0
 

Author Comment

by:angelo_a
ID: 13650822
I found what I needed to do this. In case anyone is interested, you set the
HttpWebRequest object's Method attribute to "HEAD" which returns only
the headers for the requested resource.

You then check the header via the HttpWebResponse.Headers collection.
With this you can check for a 404 and even see what type of resource it is.
0
 
LVL 11

Expert Comment

by:sachiek
ID: 13650895
Oh that is cool.

sachi
0
 

Accepted Solution

by:
PAQ_Man earned 0 total points
ID: 13904090
PAQed with points refunded (500)

PAQ_Man
Community Support Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question