我的asp.net網站在發生錯誤時會記錄錯誤,但有時只會顯示它發生的代碼行。有沒有一種方法可以找出我的錯誤在沒有提供這一行時發生的哪一行代碼?如何查找發生此錯誤的代碼行號?
我的Global.asax記錄用下面的代碼錯誤:
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
'Get MemberNumber
Dim MemberNumber As String
MemberNumber = User.Identity.Name.ToString
If Len(User.Identity.Name.ToString) < 1 Then
MemberNumber = "Guest"
End If
' Code that runs when an unhandled error occurs
Dim objErr As Exception = Server.GetLastError().GetBaseException()
Dim ErrorDescription As String = "<b>Error Caught in Page_Error event</b><hr><br>" & _
"<br><b>Member:</b> " & MemberNumber & _
"<br><b>Error in: </b>" & Request.Url.ToString() & _
"<br><b>Source Error:</b><br>" & objErr.Source.ToString() & _
"<br><b>Error Message: </b>" & objErr.Message.ToString() & _
"<br><b>Stack Trace:</b><br>" & _
objErr.StackTrace.ToString()
ErrorDescription = ErrorDescription & "<br /> <br /><b>Form Variables</b>"
For Each x As String In Request.Form
If Trim(Request.Form(x).ToString).Contains("__VIEWSTATE") = False Then ErrorDescription = ErrorDescription & (x & ": ") & Request.Form(x) & "<br />"
Next
「日誌錯誤 cms.Application_Error_Log_Add(ErrorDescription中) 結束小組
我試圖找到行其上錯誤發生在此:
Source Error: Microsoft.VisualBasic
Error Message: Input string was not in a correct format.
Stack Trace:
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat) at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)Form Variables__EVENTTARGET: ctl00$ContentPlaceHolder1$SchoolQuestions$ckAdmin __EVENTARGUMENT: ctl00_RadScriptManager1_TSM: ;;System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35:en-US:94b8a2b4-5efc-4f4c-9641-d912b698978d:ea597d4b:b25378d2;Telerik.Web.UI, Version=2010.3.1317.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en-US:4818cc11-a19b-4572-9f4d-207fcad19ad2:16e4e7cd:b7778d6c:e085fe68 __LASTFOCUS: __VIEWSTATE: ctl00$ContentPlaceHolder1$SchoolQuestions$ddSchoolID: 92 ctl00$ContentPlaceHolder1$SchoolQuestions$ckAdmin: on ctl00$ContentPlaceHolder1$SchoolQuestions$tMyName: ctl00$ContentPlaceHolder1$SchoolQuestions$tLast: ctl00_ContentPlaceHolder1_SchoolQuestions_tEventID_ClientState: {"enabled":true,"emptyMessage":"","minValue":0,"maxValue":70368744177664} __EVENTVALIDATION: /wEWQQL+raDpAgLh8t3iBgK25MzWDwL+zrvtDAK7i6q7AwK8i5q7AwKui6a7AwK9i667AwK6i5K7AwK5i567AwK5i5q7AwK7i8a4AwK5i4K7AwK4i5K7AwK/i567AwK5i5K7AwK9i5q7AwK4i4K7AwK8i6a7AwK/i8q4AwK/i5q7AwK9i567AwKui667AwK8i8a4AwK8i667AwK8i567AwK4i5q7AwK9i6a7AwK4i6a7AwK6i6a7AwK6i5a7AwK4i667AwK7i5a7AwK8i6q7AwK5i6q7AwK9i8a4AwK6i8a4AwK5i8a4AwK7i4K7AwK/i6q7AwK/i4K7AwK/i667AwK8i4K7AwK9i5a7AwK9i4K7AwK8i8q4AwK/i5K7AwK/i8a4AwK8i5a7AwKui6q7AwK/i5a7AwK/i6a7AwK4i5a7AwK8i5K7AwK4i6q7AwK9i6q7AwK5i667AwKY7+DxBgKbn7baCAK/qaGzCwLO8djHDQKroLz/DgLHmuLYBwLdl66XDgKbip7xDmPB2eQq30MMK1HtYTBNYWWD7h+z
它看起來像複選框標記爲「ckAdmin」導致此錯誤,但我不知道如何追蹤它。我該如何去追蹤這個錯誤或找到這個錯誤發生的代碼行?