我找HttpExceptions我global.asx的子的Application_ErrorServer.Transfer的(「error_404.aspx」)中的Application_Error返回一個空白頁
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim ex As Exception = HttpContext.Current.Server.GetLastError()
If ex IsNot Nothing Then
If TypeOf (ex) Is HttpUnhandledException Then
If ex.InnerException Is Nothing Then
Server.Transfer("error.aspx", False)
End If
ex = ex.InnerException
End If
If TypeOf (ex) Is HttpException Then
Dim httpCode As Integer = CType(ex, HttpException).GetHttpCode()
If httpCode = 404 Then
Server.ClearError()
Server.Transfer("error_404.aspx", False)
End If
End If
End If
End Sub
我可以通過這個代碼步,確認它確實擊中Server.Transfer(「error_404.aspx」)以及error_404.aspx的Page_Load,但它顯示的只是一個空白頁面。
確保將呼叫添加到您的錯誤記錄系統。如果發生未處理的異常,你想知道,所以你可以去處理它。 – tsilb 2010-03-28 01:44:28