본문 바로가기

others

ASP 500 Error 처리 페이지

<% @Language="VBSCRIPT" %>

<%
 Option Explicit
'-------------------------------------------------------------------------------------
'  PROGRAM ID  : ErrHandler.asp
'  DESCRIPTION  : 500 Error User Define Handler page
'  AUTHOR    : lee young hwan
'  CREATE DATE  : 2005-05-30

'--------------------------------------------------------------------------------------

 On Error Resume Next
 Response.Clear
 Dim objError
 Set objError = Server.GetLastError()
%>
<html>
<head>
<title>ASP 500 Error</title>
<style>
body {color: #3E3E3E; font-family: tahoma,굴림,돋움,helvetica, arial,sans-serif; font-size: 9pt}
table {color: #3E3E3E; font-family: tahoma,굴림,돋움,helvetica, arial,sans-serif; font-size: 9pt}
td {color: #3E3E3E; font-family: tahoma,굴림,돋움,helvetica, arial,sans-serif; font-size: 8pt; border-bottom: #6380B7 1px solid;}
</style>

</head>
<body>
<br><br><br><br>
<h2 align="center">ASP 500 Error</h2>
<p align="center">다음과 같은 에러가 발생하여, 로그파일에 에러정보를 기록하였습니다. 빠른 시간내에 수정하도록 하겠습니다.</p>

<table width="650" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" align="center">
 <tr align="center" height="25">
   <td align="left">Date</tr>
   <td align="left"><%=now()%></td>
 </tr>
 <tr align="center" height="25">
   <td align="left">Domain</tr>
   <td align="left"><%=Request.ServerVariables("HTTP_HOST")%></td>
 </tr>

 <tr align="center" height="25">
   <td align="left">Browser</tr>
   <td align="left"><%=Request.ServerVariables("HTTP_USER_AGENT")%></td>
 </tr>
<% If Len(CStr(objError.ASPCode)) > 0 Then %>
 <tr align="center" height="25">
   <td align="left">IIS Error Number</tr>
   <td align="left"><%=objError.ASPCode%></td>
 </tr>
<% End If %>
<% If Len(CStr(objError.Number)) > 0 Then %>
 <tr align="center" height="25">
   <td align="left">COM Error Number</tr>
   <td align="left"><%=objError.Number%>
   <%=" (0x" & Hex(objError.Number) & ")"%></td>
 </tr>
<% End If %>
<% If Len(CStr(objError.Source)) > 0 Then %>
 <tr align="center" height="25">
   <td align="left">Error Source</tr>
   <td align="left"><%=objError.Source%></td>
 </tr>
<% End If %>
<% If Len(CStr(objError.File)) > 0 Then %>
 <tr align="center" height="25">
   <td align="left">File Name</tr>
   <td align="left"><%=objError.File%></td>
 </tr>
<% End If %>
<% If Len(CStr(objError.Line)) > 0 Then %>
 <tr align="center" height="25">
   <td align="left">Line Number</tr>
   <td align="left"><%=objError.Line%></td>
 </tr>
<% End If %>
<% If Len(CStr(objError.Description)) > 0 Then %>
 <tr align="center" height="25">
   <td align="left">Brief Description</tr>
   <td align="left"><%=objError.Description%></td>
 </tr>
<% End If %>
<% If Len(CStr(objError.ASPDescription)) > 0 Then %>
 <tr align="center" height="25">
   <td align="left">Full Description</tr>
   <td align="left"><%=objError.ASPDescription%></td>
 </tr>
<% End If %>
</table>
</body>
</html>
<%

'에러로그 파일에 기록..
Dim Fso, LogPath, Sfile
Set Fso=CreateObject("Scripting.FileSystemObject")

LogPath = Server.MapPath ("/ErrHandler/log/Err") & date & ".log"


Set Sfile = Fso.OpenTextFile(LogPath,8,true)

Sfile.WriteLine "Date : " & now()
Sfile.WriteLine "Domain : " & Request.ServerVariables("HTTP_HOST")
Sfile.WriteLine "Browser : " & Request.ServerVariables("HTTP_USER_AGENT")

If Len(CStr(objError.ASPCode)) > 0 Then
Sfile.WriteLine "IIS Error Number : " & objError.ASPCode
End If

If Len(CStr(objError.Number)) > 0 Then
Sfile.WriteLine "COM Error Number : " & objError.Number & " (0x" & Hex(objError.Number) & ")"
End If

If Len(CStr(objError.Source)) > 0 Then
Sfile.WriteLine "Error Source : " & objError.Source
End If

If Len(CStr(objError.File)) > 0 Then
Sfile.WriteLine "File Name : " & objError.File
End If

If Len(CStr(objError.Line)) > 0 Then
Sfile.WriteLine "Line Number : " & objError.Line
End If

If Len(CStr(objError.Description)) > 0 Then
Sfile.WriteLine "Brief Description : " & objError.Description
End If

If Len(CStr(objError.ASPDescription)) > 0 Then
Sfile.WriteLine "Full Description : " & objError.ASPDescription
End If
Sfile.WriteLine chr(13)


Sfile.Close
Set Fso=Nothing
Set objError=Nothing
%>

'others' 카테고리의 다른 글

JEUS Context  (0) 2006.01.19
motion graphic  (0) 2005.08.17
WScript.Network 이용해서 네트워크상의 파일정보 가져오기  (0) 2005.05.20
ASP+ORACLE  (0) 2005.02.01
테이블 한줄에 3개씩 들어가게 만들기  (0) 2004.08.30