- ASP - Server Variables
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·What's New?
Mail List


404 Error Page (CDONTS)
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 n the server will be made available as a query string value and can be outputted as a message to the webmaster.  Sending a message to the webmaster can be done a number of ways this example demonstrates the use of CDONTS.  This example has the mail portion commented out as not to generate a mail message during this example.  A demonstration of the 404 error page can be seen by clicking here.  (Some examples of other 404 error pages:  Yahoo!, Excite, Disney, NBC, Bloomberg)
View the Output
Text View
Print View
Mail this Link
Download the Code

<title> - File Not Found)</title>
<body bgcolor="#FFFFFF">

<% querystring=trim(replace(request.servervariables("query_string"),"404;",""))
' Grab the server varible for querystring. If the user was redirected to
' this page beacuse a file was not found the server variable query_string
' would contain a string similar to this convention
' 404;
' for display pirposes the 404; is removed via text replace 

if querystring <> "" then %>

The item you were looking for <br>
<%= querystring %> <br>
could not be located on the server.<br>
An email message has been sent to the webmaster to correct this ASAP.<p>
' If you have CDONTS installed this will send a mail message to any address you want
' However, this portion of the script has been commented out to avoid us getting mail
' from the output of this script

if right(referrer,3) <> "ico" then 
' Check to see if the file missing is an ico request
' IE 5 looks for it everywhere and you may want to filter it out
' as a 404 error for an favicon.ico or one with a broken link in 
' LINK REL="SHORTCUT ICON" will not result in the user being redirected to this page

' Here we begin building our mail message varible
' by stating which document as missing and when the error occurred 
' and follwing it with all the servervaribles (This will tell which browser
' they were using and a few other helpful items
' message = message + "The following page was requested and not found on the server at " & now() &chr(13)
' message = message & querystring & "<br> Below are all the server varibles for the request<p>" & message_rpt

' set sm = server.createobject("CDONTS.newmail") 
' Create the CDONTS mail object

' sm.from = "" 
' = "" 
' Set the mail adress for the sender and the mail address that
' will receive the message they both should be valid addresses

' sm.subject = "File Not Found - "& querystring
' Create a subject with name of the location that was requested

' sm.bodyformat = 0 'if sending as HTML
' sm.mailformat = 0 'if sending as HTML
' Place the mail format to html

' sm.body = message 
' Set the body of the message equal to the text string created

' sm.send 
' Send the mail message

' set sm = nothing 
' Clean up the server

end if 'End check for .ico files

' If a user were to directly hit your 404 error page
' without generating an error display this alternate message

You have reached the 404 error page however,<br>
we could not detect a broken link or a missing file<p>
<% end if 'end check of querystring values %>
To return to the page you were previously on click <a href="javascript:history.back()">here</a>.





ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement is hosted by
    Donate Food Online with a Mouse Click at
    Donate Land Online with a Mouse Click at
    © 1999 - 2018
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3