|
CodeAve.com - ASP - Server Variables | |||
|
|
|||
| 404 Error Page (CDONTS) | ||||
|
|
||||
<html> <title>CodeAve.com(404 - 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;http://www.yourservsername.com/name_of_missing_file.ext ' 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 = "from_mail_address@yourserver.com" ' sm.to = "to_mail_address@yourserver.com" ' 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 else ' 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>. </body> </html>
|
||||
|
|
||||