This is probably a lark, but for the recaptcha control as it sometimes takes a long time to render, is this possible?
If it takes more than say 5 seconds to render, I'd like to stop the rendering of the object and display my own captcha.
I'd start a timer on page load and if 5 seconds has elapsed, in some event in the recaptcha control (prerender?), I'd cancel the render or make it invisible or something to that effect. It is a 3rd party user control, so I don't have the source.
Update:
I tried the code below after I posted. It sort of works in that if the user control can't connect its server, ie - I turn disconnect my internet connection, but it doesn't sense when there is a really long pause when the control has waiting for the server to get back to it. Even if I change the millisecond interval to 1, the control renders.
<MTAThread()> _
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim ucChk As New UCExistenceChecker(recaptcha, Me)
Dim doFindUC As System.Threading.TimerCallback = AddressOf ucChk.FindUC
Dim stateTimer As System.Threading.Timer = New System.Threading.Timer(doFindUC, Nothing, 0, 5000)
End If
End Sub
Public Class UCExistenceChecker
Dim _r As Recaptcha.RecaptchaControl
Dim _pg As Page
Sub New(ByVal r As Recaptcha.RecaptchaControl, ByVal pg As Page)
_r = r
_pg = pg
End Sub
Sub FindUC(ByVal stateInfo As Object)
If _pg.FindControl("recaptcha") Is Nothing Then
_r.SkipRecaptcha = True 'This "unrenders" the control, sort of.
End If
End Sub
End Class