HttpWebResponse Exceptions

This is a discussion on HttpWebResponse Exceptions within the C# Programming forums, part of the General Programming Boards category; Hi, I have an odd problem and hoping someone may have come across this before. I have created a web ...

  1. #1
    Registered User Boomba's Avatar
    Join Date
    Jun 2003
    Posts
    89

    HttpWebResponse Exceptions

    Hi,

    I have an odd problem and hoping someone may have come across this before. I have created a web parser in C# using the same method as THIS example. I am currently testing my code by grabbing a few URLs I thought of off the top of my head. It works for most of them but there are two that are failing with different exceptions. I'm dumping my exceptions to a log file:

    WebException Raised. The following error occured : Timeout for URL http://www.digg.com.

    WebException Raised. The following error occured : ProtocolError for URL http://www.hotmail.com.

    I know both these sites are up and running and this is consistent

    is it possible these websites are not letting me grab their data because its not through a browser?

    thanks in advance,
    Boomba

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Well, try setting the User-Agent header in the request to a known browser header and see if you get better results. That's the only chance the servers have of detecting what is contacting them.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Intercepting Fortran exceptions
    By MarkZWEERS in forum C++ Programming
    Replies: 2
    Last Post: 08-06-2008, 09:13 AM
  2. Debug --> Exceptions in Visual Studio 2005
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 08-10-2007, 02:12 AM
  3. Need advice: catch exceptions or call methods to check bits?
    By registering in forum C++ Programming
    Replies: 1
    Last Post: 10-03-2003, 01:49 PM
  4. causing default exceptions to throw additional info
    By lightatdawn in forum C++ Programming
    Replies: 14
    Last Post: 08-06-2003, 06:39 PM
  5. Throwing exceptions with constructors
    By nickname_changed in forum C++ Programming
    Replies: 14
    Last Post: 07-08-2003, 09:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21