The Wayback Machine - https://web.archive.org/web/20081201150553/http://www.webreference.com/html/tutorial30/6.html


spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / html / tutorials / 30 / 6

index1234567

HTTP for HTML Authors, Part III

Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

Error response codes

Together with the redirect response codes, these response codes give you a good repertoire with which to describe the outcome of form submission. But what if everything doesn't go according to plan with a request and there's some sort of error producing the requested resource?

HTTP defines several error codes for this case. There are two kinds of errors: Client errors and server errors. A client error indicates that the user agent did something wrong: issued a malformed HTTP request, tried to access an unauthorized resource or something similar. Server errors indicate that the server encountered an error when processing a request.

Much like 201 Created and 202 Accepted, these codes are meant to be associated with a document describing the specific nature of the error to the user. It's a good idea to supply contact details for support or links to main entry points into your site with these errors so as to help the user recover from the error.

These errors are usually created automatically by your Web server software, and the document is usually a very generic error message. It's a good idea to customize these error messages, both for making them more descriptive, and also so that they fit in with the design of the rest of your site.

Client error codes start with a 4; the most popular one by far is 404 Not Found, which we've already discussed; it should be, and often is, returned when the resource requested by the user agent does not exist in the server.

Other codes include 403 Forbidden, which indicates that although the requested resource might exist on the server, the user is not allowed to access it; perhaps because he has to log in with a username and password somewhere, or perhaps because he cannot access it unless he is on a local intranet.

405 Method Not Allowed indicates that you cannot use the specified HTTP request method to access this resource. This is useful for stopping enterprising individuals from using POST when they should be using GET or vice versa.

406 Not Acceptable indicates that the user has no document to return that is of a type acceptable to the user agent as specified in the various Accept- headers, which we discussed in Part II.

410 Gone is similar to a redirect, except that the server can't redirect you anywhere because the resource doesn't exist anywhere anymore. This is a very useful alternative to 404 Not Found in the case of removed documents, since it tells the user that yes, something used to be here, but it's not here anymore, so the user knows this isn't just a typo or a bad link.

From the server response codes, the most important one is 500 Internal Server Error. It's the HTTP equivalent of saying “Oops!” and raising your hands - it means that the server could not process the request for some unexpected reason. It is useful to allow the user to contact the administrator and submit a bug report for this error.

Another useful server error is 503 Service Unavailable. You can use this to inform users that the service they're asking for is temporarily unavailable, for instance if the system is undergoing maintenance or if it is overloaded.

index1234567

Next Page...

http://www.internet.com/

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Copyright 2008 Jupitermedia Corporation All Rights Reserved.

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
  PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
Go Parallel Article: Q&A; with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
HP eBook: Guide to Storage Networking
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Crucial Triples Up With New Three-Channel DDR3 Kits · Meet the Finalists: Excellence in Technology Awards · Tealeaf Offers Insight to Mobile Customer Behavior

URL: http://www.webreference.com/html/tutorial30/6.html

Produced by Stephanos Piperoglou
Created: March 15, 2001
Revised: March 16, 2001

Morty Proxy This is a proxified and sanitized view of the page, visit original site.