2016-11-18 56 views
1

我的經典ASP網站上有一段簡單的代碼,當頁面發生錯誤時向我發送電子郵件,因爲我在web.config中設置了一個指向頁面來處理錯誤的代碼:尋找ASP的原因錯誤

<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL"> 
    <remove statusCode="500" subStatusCode="100" /> 
    <remove statusCode="500" subStatusCode="-1" /> 
    <remove statusCode="404" subStatusCode="-1" /> 
    <error statusCode="404" path="/error_404.asp" responseMode="ExecuteURL" /> 
    <error statusCode="500" prefixLanguageFilePath="" path="/error_500.asp" responseMode="ExecuteURL" /> 
    <error statusCode="500" subStatusCode="100" path="/error_500.asp" responseMode="ExecuteURL" /> 
</httpErrors> 

這是我的代碼簡單位:

... 
set objError =   Server.getLastError() 
strNumber =    objError.AspCode 
strSource =    objError.Category 
strDesc =    newstr(objError.Description) 
strCode =    newstr(objError.Source) 
strLine =    ObjError.Line 
strASPDesc =   ObjError.ASPDescription 
strRemoteAddr =   Request.ServerVariables("REMOTE_ADDR") 
ref =     request.servervariables("HTTP_REFERER") 
str =     request.servervariables("QUERY_STRING") 
cookies =    request.servervariables("HTTP_COOKIE") 
ip_url =    strRemoteAddr 
ua =     newstr(request.servervariables("HTTP_USER_AGENT")) 
totalstring =   objError.File & "?" & str 

我然後串聯這些值加在一起,並通過電子郵件的細節我自己。

對於一個錯誤,我會得到這樣的事情:

strNumber: ASP 0126 
strSource: Active Server Pages 
strDesc: Include file not found 
strCode: 
strLine: 14 
strASPDesc: The include file '/news/aw.asp' was not found. 
strRemoteAddr: 2.101.166.175 
ref: http://example.com/sites/support/ 
str: page=cd 
cookies: usr1=62105233D8E2A062A55; fantastic%5Fcheese=1; _ga=GA1.3.1357551757.1476543431; __atuvc=2%7C41%2C1%7C42%2C0%7C43%2C0%7C44%2C9%7C45; __utma=154830755.1357551757.1476543431.1476822981.1479368067.3; __utmz=154830755.1476818175.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); ASPSESSIONIDQCBABQAR=KHGBAMBCCCENHCIPPCOFBJOO; __utmb=154830755.1.10.1479368067; __utmc=154830755; __utmt=1 
ip_url: 84.92.46.118 
ua: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 
totalstring: /sites/support/page.asp?landscape=cd 

但是,我往往只看到這個錯誤:

strNumber: 
strSource: 
strDesc: 
strCode: 
strLine: 0 
strASPDesc: 
strRemoteAddr: 43.247.156.6 
ref: http:/example.com/content/this.asp 
str: 500;http://jimpix.co.uk:80/words/check-username.asp 
cookies: ASPSESSIONIDSAABARBQ=ACDDOHOCEKIEFOCKFBFIHJBC; _gat=1; __atuvc=129%7C46; __atuvs=582e898682f62926059; _ga=GA1.3.491207786.1479439414 
ip_url: 43.247.156.6 
ua: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36 
totalstring: ?500;http:/example.com:80/content/this.asp 

有沒有錯誤的詳細信息本身,而是它總是在同一頁上。我無法弄清楚是什麼原因造成的。

是否有更詳細的錯誤日誌記錄我可以做更多的發現?直到響應緩衝區已經開始沖洗內容到客戶端

回答