2741Trapping HTTP 404 - File not foundhttp://coveryourasp.com/404Descr.aspEveryone has seen an HTTP 404 error at some point. You follow a link on a web page, and BOOM - File not found. Perhaps the author spelt it incorrectly, or the page was uploaded to the server by mistake.ASP > Tips and Tutorials > Error HandlingOct 10, 2006
Everyone has seen an HTTP 404 error at some point. You follow a link on a web page, and BOOM - File not found. Perhaps the author spelt it incorrectly, or the page was uploaded to the server by mistake.
The basic 404 error or file not found page serves two specific purposes. Firstly, to alert the user that the item they were expecting is not currently available, rather than the generic page your host may provide or worse the generic windows file not found page. Secondly, to alert the webmaster that a file is missing or a link is targeting something incorrectly. In order to provide users with a page that will show up whenever a 404 error occurs you need to change the settings on your web server to target a specific page or contact your hosting company to do this for you. Once setup, the location of any file that is requested and not found on the server will be made available as a query string value and can be outputted to a database to track where and when the erros are occuring. A demonstration of the CodeAve.com 404 error page can be seen by clicking here. (Some examples of other 404 error pages: Yahoo!, Excite, Disney, NBC, Bloomberg)
Problems and coding syntax mistales can been in every serverside application. Security of application is very important. You should need to understand what's going wrong in deep of an apllication. This sample of code is an easy to use an error handling message writer. .
Did I tell you I love the new ASP Error object? It finally enables developers to control page execution. This object is used to retrieve details of the last error that occurred within an ASP page. Combine that with the ability to create custom error pages, and you have a pretty powerful tool within the development shack.
The error class, CError, allows you to display a custom dialog box with the option to have a detailed message, a general message, and log the error in a file for later reference. It also uses some JavaScript and DHTML to allow the user to drag the dialog box around. But since this article is more about the Error Handling that will not be discussed.
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.