mardi 24 janvier 2017

vb/aspx single-page model: how to implement server-side captcha while also post form data to another page?

I'm using WebCaptcha However I cannot figure out how to do the POST to verify user captcha input and then in-the-same-post-pipeline also submit the form data to a different webpage only if captcha is correct. I know this is hard w/o full code but...yeah. Here is the button that fires the form:

<asp:Button ID="btnSubmit" runat="server" Text=" Submit " Style="border-radius:8px" UseSubmitBehavior="false" OnClick="btnSubmit_Click" OnClientClick="" Width="6em" Height="3em" Borderstyle="Groove" Borderwidth="2" Font-Bold="true" BackColor="Navy" ForeColor="White" />

Then:

Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSubmit.Click
If Page.IsValid Then
lblResult1.Text = "CAPTCHA verification passed, your request has been sent!"
Else
lblResult1.Text = "Sorry, the CAPTCHA text was not entered properly, try again."
End If
End Sub

I was thinking I would have to add code to the Page.IsValid section that does a server-side (ajax??) post to the other webpage because in order for the btnSubmit_Click() to get control, the current page has already done a post to itself and I don't know how to interrupt that pipeline. I cannot just do a Javascript POST then since the client is not in control at this stage.




Aucun commentaire:

Enregistrer un commentaire