纠正后甚至抛出异常

时间:2015-04-30 12:44:18

标签: vb.net exception try-catch

我正在我的页面中进行一些验证,这个验证工作正常。但是当用户尝试在第一次失败后尝试传递正确的值时,会发生此错误readme.txt

VB.NET:

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.

用户更正验证捕获的数据后发生错误。

1 个答案:

答案 0 :(得分:0)

查看代码......

If Not String.IsNullOrEmpty(txtHRRemarks.Text) Then
  If txtHRRemarks.Text.Trim().Length > 3 Then
  ModalPopUpExt.Hide()
  Throw New ApplicationException("Please reduce HR Remarks (max 500 chars)")
 End If
End If

所以如果txtHRRemarks.Text.Trim()。长度&gt; 3你总是抛出异常!

相关问题