我一直在研究如何全局處理ASP.NET應用程序中的錯誤。我已經使用的web.config文件與下面的代碼解決:ASP.NET錯誤處理問題
<customErrors mode="On" defaultRedirect="errorpage.aspx">
</customErrors>
這裏是我的errorpage.aspx.vb代碼:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ex As Exception = Server.GetLastError
End Sub
我遇到的問題是Server.GetLastError
結束是什麼。我需要做什麼才能夠訪問最新的錯誤信息?由於它位於asp窗體頁面上,因此我不必在前加上HttpContext.Current.
,對嗎?
謝謝