我在asp.net 4.0 Web 应用程序中使用MSCaptcha控件。我已将提供的.dll和.xml文件放在Bin文件夹中并添加到页面顶部。这就是我在页面中使用它的方式:<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>
<cc1:CaptchaControl ID="Captcha1" runat="server"
CaptchaBackgroundNoise="Low" CaptchaLength="4"
CaptchaHeight="60" CaptchaWidth="300"
CaptchaLineNoise="None" CaptchaMinTimeout="1"
CaptchaMaxTimeout="240" FontColor = "#529E00" />
在后面的代码中,我像这样使用它:
If Page.FindControl("Captcha1").ToString = "MSCaptcha.CaptchaControl" Then
Captcha1.ValidateCaptcha(webCaptcha.Text.Trim())
If Captcha1.UserValidated Then
addComment()
Else
webWrongCaptcha.Text = "Captcha is wrong!"
End If
Else
Response.Redirect("contact.aspx?c=e")
End If
但是如果用户在之后单击按钮,我会遇到此错误CaptchaMaxTimeout
:
Line 7: Captcha1.ValidateCaptcha(webCaptcha.Text.Trim())
我该如何解决?