Web hosting - message through to the user that there has

message through to the user that there has been a problem. You can do that with any and all error messages that the server can encounter. Many ErrorDocument codes exist, but we will focus on the error messages you see typically in everyday Web browsing: . 400: Bad Request . 401: Authorization Required . 403: Forbidden . 404: Not Found . 500: Internal Server Error Numerous other error codes exist, of course. You can find a complete list at www.apache.org. Although you are seeing just a few error codes in this exercise, you can catch others as well by simply adding another ErrorDocument to the httpd.conf file. For example, if you want to implement the 501 error code, you would simply add ErrorDocument 501 /error.php?501 to your code and add the error handling in the error.php page, which you ll see shortly. Next, you ll see a simple way to show the user error messages, and then get into some more complex ways to notify the Webmaster of errors occurring on the Web site by using the mail() command that you learned previously. Try It Out Displaying Custom Error Messages To show the user error messages, follow these steps: 1. Open your text editor and save a page called error.php. 2. Enter the following code:

"Bad Request" Error Page - . (Error Code 400)

; $error_output .= The browser has made a Bad Request
; $error_output .= . Contact the system administrator ; $error_output .= if you feel this to be in error ; break; case 401: $error_output =

"Authorization Required" . Error Page - (Error Code 401)

; $error_output .= You have supplied the wrong information to . access a secure area
; $error_output .= . 253 Handling and Avoiding Errors
Check
Tomcat Web Hosting services for best quality webspace to host your web application.

Leave a Reply