I am getting some errors on my classic asp website. When the website runs for the first time it sometimes does an Internal Server Error. Then a refresh would fix it. I decid
How about setup custom pages for handle 500 and 500 100 errors?
Create some folder, let's say D:\InetPub\Web01\Err\ Add IUSR_Web01 user with write permission
In IIS for Web01 web site (sample for IIS 6.0)

Put following code in file 500.asp and 500100.asp
Option Explicit
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = #Jan 31,2000 12:30:00#
Response.Clear
Dim FS, TF, N, ASPErr
N = Now
Set ASPErr = Server.GetLastError()
Set FS = CreateObject ("Scripting.FileSystemObject")
Set TF = FS.CreateTextFile ("D:\InetPub\1click.lv\Err\500 " & "Error" & Right ("0" & Year (N), 4) & Right ("0" & Month (N), 2) & Right ("0" & Day (N), 2) & "_" & Right ("0" & Hour (N), 2) & Right ("0" & Minute (N), 2) & Right ("0" & Second (N), 2) & ".txt", True, False)
TF.Write MyErrorInfo (ASPErr, False, False, "1click.lv", "")
TF.Close
Set FS = Nothing
Response.Write MyErrorInfo (ASPErr, True, True, "1click.lv", "zam@1click.lv")
Err.Clear
The function:
Function MyErrorInfo (ASPErr, AsHTML, ShowContactInfo, WebTitle, AdminEmail)
Dim Result
Result = ""
If AsHTML = True Then
Result = Result & "Error occur "
If (ShowContactInfo = True) Then
Result = Result & ""
Result = Result & ""
Result = Result & "" & WebTitle & "
"
Result = Result & "500 Error occur
"
Result = Result & "Please contact us by email at " & AdminEmail & " and inform about this error
"
Result = Result & "Thank you for your support!"
Result = Result & ""
Result = Result & "
"
End If
Result = Result & "
"
Result = Result & "Error number: " & ASPErr.Number & "
"
Result = Result & "Error source: " & ASPErr.Source & "
"
Result = Result & "Error description: " & ASPErr.Description & "
"
Result = Result & "Error line: " & ASPErr.Line & "
"
Result = Result & "Client IP: " & Request.ServerVariables ("REMOTE_ADDR") & "
"
Result = Result & "Client Browser: " & Request.ServerVariables ("HTTP_USER_AGENT") & "
"
Result = Result & "Client Referer: " & Request.ServerVariables ("HTTP_REFERER") & "
"
Result = Result & "Path: " & Request.ServerVariables ("PATH_INFO") & "
"
Result = Result & "Request method: " & Request.ServerVariables ("REQUEST_METHOD") & "
"
Result = Result & "Request FORM: " & Request.Form & "
"
Result = Result & "Request QUERY: " & Request.QueryString & "
"
Result = Result & "
"
Result = Result & ""
Else
Result = Result & WebTitle & vbCrLf
Result = Result & "Error number: " & ASPErr.Number & vbCrLf
Result = Result & "Error source: " & ASPErr.Source & vbCrLf
Result = Result & "Error description: " & ASPErr.Description & vbCrLf
Result = Result & "Error line: " & ASPErr.Line & vbCrLf
Result = Result & "Client IP: " & Request.ServerVariables ("REMOTE_ADDR") & vbCrLf
Result = Result & "Client Browser: " & Request.ServerVariables ("HTTP_USER_AGENT") & vbCrLf
Result = Result & "Client Referer: " & Request.ServerVariables ("HTTP_REFERER") & vbCrLf
Result = Result & "Path: " & Request.ServerVariables ("PATH_INFO") & vbCrLf
Result = Result & "Request method: " & Request.ServerVariables ("REQUEST_METHOD") & vbCrLf
Result = Result & "Request FORM: " & Request.Form & vbCrLf
Result = Result & "Request QUERY: " & Request.QueryString & vbCrLf
End If
MyErrorInfo = Result
End Function