%@ Language=VBScript %> <%Response.Buffer = True%>
Internal Server
Error
<%
On Error Resume Next
'Referencing the error object
set objError = Server.getLastError()
strNumber = objError.AspCode
strSource = objError.Category
strPage = objError.File
strDesc = objError.Description
strCode = Server.HTMLEncode(objError.Source)
If strCode = "" then strCode = "No code available"
strLine = ObjError.Line
strASPDesc = ObjError.ASPDescription
'You get the entire context of the page that had the error.
'Review the server variables to see if you would want to store more information.
strRemoteAddr = Request.ServerVariables("REMOTE_ADDR")
strRemoteHost = Request.ServerVariables("REMOTE_HOST")
strLocalAddr = Request.ServerVariables("LOCAL_ADDR")
'Your basic ADO stuff. This is generic code. I would use a stored procedure to do this on SQL Server.
set rs = Server.CreateObject("ADODB.Recordset")
set Conn = Server.CreateObject("ADODB.Connection")
'SQL Server Connection, make sure you put in your information!
conn.ConnectionString = "Provider=SQLOLEDB.1;User id=;Password=;Initial Catalog=;Data Source=;"
conn.open
rs.Open "tblErrorDemo", conn, adOpenDynamic, adLockOptimistic, adCmdTable
'Adding Record
rs.AddNew
'The datetime is set on the backend as a default value.
rs("er_number") = strNumber
rs("er_source") = strSource
rs("er_page") = strPage
rs("er_desc") = strDesc + ". " + strASPDesc
rs("er_code") = strCode
rs("er_line") = strLine
rs("er_remote_addr") = strRemoteAddr
rs("er_remote_host") = strRemotehost
rs("er_local_addr") = strLocalAddr
rs.Update
%>
| Error Number: | <%=strNumber%> |
| Source: | <%=strSource%> |
| File: | <%=strPage%> |
| Description: | <%=strDesc + ". " + strASPDesc%> |
| Code: | <%=strcode%> |
| Line: | <%=strLine%> |
| Remote Address: | <%=strRemoteAddr%> |
| Remote Host: | <%=strRemoteHost%> |
| Error Code | Error Message | Extended Information |
| ASP 0100 | Out of memory | Unabled to allocate the required memory. |
| ASP 0101 | Unexpected error | The function return exception_name. |
| ASP 0102 | Expecting string input | None |
| ASP 0103 | Expecting numeric input | None |
| ASP 0104 | Operation not allowed | None |
| ASP 0105 | Index out of range | An array index is out of range. |
| ASP 0106 | Type Mismatch | A data type was encountered that cannot be handled. |
| ASP 0107 | Stack Overflow | The quantity of data being processed is above the permitted limit. |
| ASP 0115 | Unexpected Error | A trapple error occured in an external object. The script cannot continue running. |
| ASP 0177 | Server.CreateObject Failed | Invalid ProgId |
| ASP 0190 | Unexpected error | A trapple error occurred while releasing an external object. |
| ASP 0191 | Unexpected error | A trapple error occurred in the OnStartPage method of an external object. |
| ASP 0192 | Unexpected error | A trapple error occurred in the OnEndPage method of an external object. |
| ASP 0193 | OnStartPage Failed | An error occurred in the OnStartPage method of an external object. |
| ASP 0194 | OnEndPage | An error occurred in the OnEndPage method of an external object. |
| ASP 0240 | Script Engine Exception | A script engine threw exception. |
| ASP 0241 | CreateObject Exception | The CreateObject caused an exception. |
| ASP 0242 | Query OnStartPage Interface Exception | The querying object OnStartPage caused an exception. |