ローカルでアプリケーション エラーが正常に実行されます (エラーをキャッチし、それをデータベースに入れるか、メールで送信します)。しかし、それを私たちのウェブサイトに追加すると、application_error の下のコードが実行されません。
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim cookie As HttpCookie = Current.Request.Cookies("id")
Dim Code As HttpCookie = Current.Request.Cookies("code")
Dim ErrorMsg() As String
If cookie Is Nothing Then
Else
Dim cDBConnection As clsDBConnection = New clsDBConnection(GetConnection, enumEgswFetchType.DataReader)
If IsNothing(Code.Value) Then
ErrorMsg = {0, Request.UserHostAddress.ToString, Me.Session.SessionID, Context.Request.RawUrl, Date.Now, Server.GetLastError.GetBaseException.Message, Server.GetLastError.GetBaseException.GetType.ToString, Server.GetLastError.GetBaseException.Data.ToString, Server.GetLastError.GetBaseException.Source, Server.GetLastError.GetBaseException.TargetSite.ToString, Server.GetLastError.GetBaseException.StackTrace}
cDBConnection.InsertErrorLog(ErrorMsg(0), ErrorMsg(1), ErrorMsg(2), ErrorMsg(3), ErrorMsg(4), ErrorMsg(5), ErrorMsg(6), ErrorMsg(7), ErrorMsg(8), ErrorMsg(9), ErrorMsg(10))
Response.Redirect("~/Error.aspx")
Else
ErrorMsg = {Code.Value, Request.UserHostAddress.ToString, cookie.Value, Context.Request.RawUrl, Date.Now, Server.GetLastError.GetBaseException.Message, Server.GetLastError.GetBaseException.GetType.ToString, Server.GetLastError.GetBaseException.Data.ToString, Server.GetLastError.GetBaseException.Source, Server.GetLastError.GetBaseException.TargetSite.ToString, Server.GetLastError.GetBaseException.StackTrace}
cDBConnection.InsertErrorLog(ErrorMsg(0), ErrorMsg(1), ErrorMsg(2), ErrorMsg(3), ErrorMsg(4), ErrorMsg(5), ErrorMsg(6), ErrorMsg(7), ErrorMsg(8), ErrorMsg(9), ErrorMsg(10))
Response.Redirect("~/Error.aspx")
End If
'End If
End If
End Sub