Handling errors in the HTTP protocol

I have developed a VB application that uses your HTTP control. It works fine most of the time. Sometimes I get protocol-related errors such as time-outs and error code 404 and probably others. I am now at the point where I have to start writing some code to handle error conditions.

Do you have any recommended ways to handle the most common errors, any tips, things to do or not do?

Date Entered: 12/04/1997    Last Updated: 06/04/2004

You can check the StatusLine property for the first line of Server's response. If the server returns an error code of the families 3xx (redirection), 4xx (client error) or 5xx (server error) the HTTP control will return this error to the user.

The control will return error 20152 (Visual Basic/ActiveX Edition) or 151 (other Editions) with a text like: 'xxx Error Description' where 'xxx' is a three digit HTTP error code.

The most important error codes returned by the server are listed below. Please refer to RFCs for more details on HTTP protocol as well as to the Help files for the control's properties.

     301 Moved Permanently
     302 Moved Temporarily
     303 See Other

All three redirect to a new URL which was previously given in the Header Event with the value of Field parameter to 'Location' (The field is case insensitive, but the location is case-sensitive) Setting the FollowRedirects property will allow you to follow these redirections automatically.

     304 Not changed

Sent only if property NotModifiedSince is used in a Get Action.

     400 Bad Request

Error in the request, please correct it.

     401 Unauthorized

The request requires user authentication. Please use the User and Password properties

     403 Forbidden

The server understood the request, but is refusing to fulfill it. Check the message if the Server provides more information.

     404 Not Found

The server has not found anything matching the Request-URL.

     500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

     501 Not Implemented

The server does not support the functionality required to fulfill the request.

     503 Service Unavailable

The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.

Please refer to the Help files for the control's properties and to the RFCs for the HTTP protocol.


We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.