ASP Customised Error Handling

 

If you would like customised error handling with ASP, then this script is one example of many.

Please note: I have deliberately put an error in the below script. I have missed out an "e" in Response.Writ ("The time on the server is: " & Time())

The error output would be the following:

 

Welcome to wizzardweb.co.uk
Sorry you have encoutered an error on this page.
Your error number is 438
The error source is Microsoft VBScript runtime error
The error description is Object doesn't support this property or method

 

Script Source

<%
On Error Resume Next

' Beging you script
Dim strMessage
strMessage = "Welcome to wizzardweb.co.uk "
Response.Write (strMessage)
Response.Write ("<br>")
Response.Writ ("The time on the server is: " & Time())
' End your script

If Err.number <> 0 then 'if there is an error
response.write ("Sorry you have encoutered an error on this page." & "<br />")
response.write ("Your error number is " & Err.number & "<br />")
response.write ("The error source is " & Err.source & "<br />")
response.write ("The error description is " & Err.description & "<br />")
End If
%>

 

Please let me know if this script was helpful to you.

[rating]