This is a migrated thread and some comments may be shown as answers.

Captcha only validates the second time

8 Answers 401 Views
Captcha
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 23 Jan 2014, 08:00 PM
I have been searching around about this issue and I found some related information but I just can't seem to get Telerik's Captcha to work properly.

No matter what I do, without fail the captcha will only validate on the second try. On the first try, it fails, and the second time it always works.

I do not use a web farm or cluster, it's just one server. I've tried most things that are documented, like changing the ImageStorageLocation to Session. The behavior is the same either way.

Anyone have any ideas?

8 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Jan 2014, 06:08 AM
Hi Alexander,

Unfortunately I couldn't replicate the issue at my end. Please have a look into the following code snippet which works fine at my end. Let me know the given code is working for you or not.

ASPX:
<telerik:RadCaptcha ID="RadCaptcha1" runat="server" ErrorMessage="code entered is not valid."
    ValidationGroup="Group">
</telerik:RadCaptcha>
<asp:Button ID="btnVerify" runat="server" Text="Submit Page" Width="150px" ValidationGroup="Group"
    OnClick="btnVerify_Click">
</asp:Button>
 
C#:
protected void btnVerify_Click(object sender, EventArgs e)
{
    if (Page.IsValid)
    {
        Response.Write("<script>alert('Succes');</script>");
    }
}

Please provide your full code if it doesn't help.
Thanks,
Shinu.
0
Alexander
Top achievements
Rank 1
answered on 24 Jan 2014, 03:41 PM
Thanks for your help. I'm going to try to set this up in a blank project and see if the issue persists. I may attach my code in a while if I don't make any progress.
0
Accepted
Vessy
Telerik team
answered on 24 Jan 2014, 05:34 PM
Hi Alexander,

I have just answered your support ticket on the subect - for convenience I am pasting my answer here as well:

Most probably the experienced error is connected with the way the async PostBack is triggered. Basically the Captcha updates its code on every page life cycle, even if its element is not updated. The image, on another side is changed only then the Captcha is updated. This is why I would suggest you to try setting the Captcha's image PersistCodeDuringAjax property to true and see whether the problem still persist:
<telerik:RadCaptcha ID="RadCaptcha1" ValidationGroup="Submit" runat="server" ErrorMessage="Text entered below is not valid" ForeColor="Red" EnableRefreshImage="True">
    <CaptchaImage PersistCodeDuringAjax="true" />
</telerik:RadCaptcha>


Kind regards,
Veselina Raykova
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
rightincode
Top achievements
Rank 1
answered on 25 Mar 2014, 02:49 AM
I can consistently reproduce this problem on a simple form (no ajax postbacks/panels, etc.) with a validationgroup.  In the validationgroup I have a radtextbox, requiredfieldvalidator, captcha, and radbutton.  If I remove the validationgroup, the captcha is valid when I enter the correct input on the first attempt.  With the validationgroup, the captcha is invalid on the first attempt with the correct input and valid only on the second attempt with the correct input.

I'm using version 2014.1.225.45 and .net 4.5.

Any additional suggestions on correcting this issue would be helpful.
0
Slav
Telerik team
answered on 27 Mar 2014, 12:45 PM
Hello Richard,

I tried to reproduce the problem by creating a sample according to the description your provided, but to no avail. You can find the test sample attached to this post. Please check it and let me know what am I missing and how it should be modified for the issue to occur. The behavior that is experienced on my end is shown in the following screen capture: http://screencast.com/t/hBIUlLY3s

You can also edit that page in order to replicate your setup so that I can inspect the problem locally and suggest a solution, if there is such.

Regards,
Slav
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
rightincode
Top achievements
Rank 1
answered on 29 Apr 2014, 12:52 PM
Thanks Slav!

We were able to figure out the problem.
0
Slav
Telerik team
answered on 30 Apr 2014, 02:02 PM
Hi Richard,

I am very happy that you succeeded in resolving the problem.

Will it be possible to send your configuration of the RadCaptcha, as well as information how you fixed the problem, so that we can research whether it originated from the captcha?

Regards,
Slav
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Greg
Top achievements
Rank 1
answered on 07 Mar 2017, 05:57 PM
Please post the solution here - I am also encountering this issue.
Tags
Captcha
Asked by
Alexander
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Alexander
Top achievements
Rank 1
Vessy
Telerik team
rightincode
Top achievements
Rank 1
Slav
Telerik team
Greg
Top achievements
Rank 1
Share this question
or