Display 500,100 errors even with crashes in IIS preventing you from viewing errors remotely
If you are working with ASP Classic, and you picked up a server that does not display the error that is being displayed at all, showing pages that prevent you from viewing and debugging the problem, follow a customized script to inspect the erors so that they can be analyzed with facility.
This script even allows that if there is an error, and if improved, it can perform other activities such as tracking errors with users and saving to a database or triggering emails.
But this only works with errors coming from ASP pages.
Customized error page, displaying internal errors as the default of "Detailed".
<%@ language="vbscript" codepage="65001" %>
<%
response.Charset = "utf-8"
x= ""
dim objError
Set objError = Server.GetLastError()
select case lcase(Hex(objError.Number))
case "800a03ea"
x=x&"Microsoft VBScript erro de compilação (" & lcase(Hex(objError.Number)) & ")" & vbcrlf case "800a000b"
x=x&"Microsoft VBScript erro de execução (" & lcase(Hex(objError.Number)) & ")" & vbcrlf case "80004005" ' ASP Code
x=x& "Active Server Pages error '" & objError.ASPCode & "'" & vbcrlf case else
x=x&"Microsoft VBScript erro (" & lcase(Hex(objError.Number)) & ")" & vbcrlf end select
If Len(CStr(objError.Description)) > 0 Then
x=x& vbcrlf & objError.Description & vbcrlf
End If
If Len(CStr(objError.ASPDescription)) > 0 Then
x=x& objError.ASPDescription & vbcrlf
End If
If Len(CStr(objError.File)) > 0 Then x=x& vbcrlf & objError.file
If Len(CStr(objError.Line)) > 0 Then
p=p&", linha " & objError.Line
x=x& ", linha " & objerror.line
End If x=x& vbcrlf
End If
If Len(CStr(objError.Source)) > 0 Then
x = x & vbcrlf & objError.Source & vbcrlf
If Len(CStr(objError.Column)) > 0 Then
for i = 1 to objError.Column
x=x&"-"
next
x=x&"^"
end if End If
response.write "<pre style=""font-family:arial;font-size:13px;"">" & x & "</pre>"
response.end()
%>
Web.Config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="default.aspx" />
<add value="default.asp" />
<add value="index.asp" />
<add value="index.aspx" />
<add value="index.php" />
</files>
</defaultDocument>
<httpErrors errorMode="Custom">
<remove statusCode="500" subStatusCode="100" />
<error statusCode="500" subStatusCode="100" path="/_iis_erros.asp" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>
No comments