An HTTP request can fail because of a network error or because of problems encountered while the request is executing on the web server.
If a network error occurs while transmitting a request message, error information is available from the underlying network component; e.g. Windows Sockets or WinInet. Monitoring tools like HttpWatch can display error codes for situations such as:
HTTP status codes are returned by web servers to describe if and how a request was processed. The codes are grouped by the first digit:
Any code starting with '1' is an intermediate response and indicates that the server has received the request but has not finished processing it. For example, IIS initially replies with 100 Continue when it receives a POST request and then with 200 OK once it has been processed (See 6. Methods)
These codes are used when a request has been successfully processed. For example, the value 200 is used when the requested resource is being returned to the HTTP client in the body of the response message.
Codes starting with a '3' indicate that the request was processed, but the browser should get the resource from another location. Some examples are:
302 |
The requested resource has been temporarily moved and the browser should issue a request to the URL supplied in the Location response header. (See 7. Redirection) |
304 |
The requested resource has not been modified and the browser should read from its local cache instead. The Content-Length header will be zero or absent because content is never returned with a 304 response (See 5. Caching for more detail) |
The server returns these codes when they is a problem with the client's request. Here are some examples:
401 |
Anonymous clients are not authorized to view the requested content and must provide authentication information in the WWW-Authenticate request header. (See 10. Authentication for more detail) |
404 |
The requested resource does not exist on the server |
A status code starting with the digit 5 indicates that an error occurred on the server while processing the request. For example:
500 |
An internal error occurred on the server. This may be because of an application error or configuration problem |
503 |
The service is currently unavailable, perhaps because of essential maintenance or overloading |
Question: Can you work out why the following images are not displayed correctly?
|
Image A: |
![]() |
The hostname used in the URL is missing a 'w' (i.e. ww rather than www) causing the error ERROR_INTERNET_NAME_NOT_RESOLVED to be returned by WinInet. |
|
Image B: |
![]() |
The URL for this image incorrectly uses port 81 and the error ERROR_INTERNET_CANNOT_CONNECT is returned by WinInet. |
|
Image C: |
|
The socket connection was closed before the server could return its response, causing WinInet to return the error ERROR_HTTP_INVALID_SERVER_RESPONSE. |
|
Image D: |
![]() |
The request was processed by the server but the server returned 404 Object Not Found because the image does not exist at the specified location. |
|
Image E: |
|
No access to this image is allowed. The server returned 403 Forbidden |
|
Image F: |
|
The server returned 501 Internet Server Error |
Copyright © 2002 - 2008 Simtec Limited, All Rights Reserved