1
我通过我的Global.asax处理在这种方法的错误:尝试catch最终块..当我处理global.asax中的错误时,仍然需要它们吗?
Dim CurrentException As Exception
CurrentException = Server.GetLastError()
Dim LogFilePath As String = Server.MapPath("~/Error/" & DateTime.Now.ToString("dd-MM-yy.HH.mm") & ".txt")
Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter(LogFilePath)
sw.WriteLine(DateTime.Now.ToString)
sw.WriteLine(CurrentException.ToString())
sw.Close()
在我的代码,我目前还没有其他的错误处理。我还应该插入try,catch,finally块吗?
谢谢。