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

RadCaptcha is refreshing in updatepanel controls with AsyncPostBackTrigger

8 Answers 245 Views
Captcha
This is a migrated thread and some comments may be shown as answers.
Thenmozhi
Top achievements
Rank 1
Thenmozhi asked on 24 Dec 2010, 08:53 AM
Hi ,

I have 2 asp .net Dropdowns Country and state with autopostback=true.

I have added controls in asp .net update panel with content template.

As like below...

 <asp:UpdatePanel ID="updateapnel1" runat="server">
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="ddlcountry" EventName="SelectedIndexChanged" />
    <asp:AsyncPostBackTrigger ControlID="ddlstate" EventName="SelectedIndexChanged" />    
    </Triggers>
       <ContentTemplate>
Controls are here [Have a Rad captcha in this form]
</ContentTemplate>
 </asp:UpdatePanel>

Getting New images during the item selection change in dropdown...

can you please tell how to eliminate the rad capcha refresh...

Thanks in advance..
Thenmozhi.R

8 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 24 Dec 2010, 09:02 AM
Hello Thenmozhi,

The RadCaptcha control is designed to refresh its code on every trip to the server regardless of the type of the Request, postback or ajax call. This is so due to security reasons.

Greetings,
Pero
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Thenmozhi
Top achievements
Rank 1
answered on 24 Dec 2010, 09:15 AM
Thanks for your immidiate response..

I solved the issue as like below..

I have placed the capcha control outside the update panel..

And checking in button click RadCaptcha1.IsValid() if it is true than i am allowing user to save the details.

Please suggest me anywhere wrong...
0
Pero
Telerik team
answered on 24 Dec 2010, 09:39 AM
Hello Thenmozhi,

Placing the RadCaptcha control outside the UpdatePanel would not resolve the issue, because the Captcha code will be changed, but will not be displayed on the image. So, even if the user enters the code she/he sees on the picture, the RadCaptcha will always return false because the code has changed after the ajax request.
So, I would suggest placing the RadCaptcha inside the UpdatePanel.

Greetings,
Pero
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Thenmozhi
Top achievements
Rank 1
answered on 24 Dec 2010, 09:44 AM
Actually my testing team not accepting the refreshment of the image in radcaptcha in each item change.

could you suggest any implementation method to resolve this issue please..
0
Pero
Telerik team
answered on 24 Dec 2010, 10:52 AM
Hi Thenmozhi,

There is no straight forward way to override the default behavior of the RadCaptcha control, when it comes to refreshing its text code.
The only way would be to create a custom HttpHandler to serve the CaptchaImage. We have a sample that demonstrates how to this. Please find it attached to the thread. I have modified the code so that the RadCaptcha always renders the same code. You could easily implement your own condition for generating CAPTCHA codes.

Greetings,
Pero
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Thenmozhi
Top achievements
Rank 1
answered on 24 Dec 2010, 11:27 AM
Thanks a lot..

Your solution solved my issue..

Thanks for your quick responses.

My Heartiest wishes for this Christmas...

Advance Happy New Year :)
0
Thenmozhi
Top achievements
Rank 1
answered on 27 Dec 2010, 02:43 PM
Hi ,

Sorry to dist rub you again..

Your solution is worked fine in my local.

After deploying the site it is not showing the image.

Showing the below text

This is captcha image

My application has the separate app pool with .net frame work 4.0.

Our server has both the .net and telerik installed.

Please suggest me how to proceed with this..

0
Lini
Telerik team
answered on 30 Dec 2010, 02:41 PM
Hello,

Make sure that you have added the custom captcha handler to both the <system.web> and <system.webServer> sections of the web.Config file for your web application. This will ensure that the handler will work both in development and production. For example:

<system.web>
    <httpHandlers>
        <add verb="*" path="MyCustom.CaptchaHandler.axd" type="CustomNameSpace.CaptchaImageHandler"/>
    </httpHandlers>
</system.web>
<system.webServer>
    <handlers>
        <add name="MyCustom_CaptchaHandler_axd" verb="*" preCondition="integratedMode" path="MyCustom.CaptchaHandler.axd" type="CustomNameSpace.CaptchaImageHandler"/>
    </handlers>
</system.webServer>


Kind regards,
Lini
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Captcha
Asked by
Thenmozhi
Top achievements
Rank 1
Answers by
Pero
Telerik team
Thenmozhi
Top achievements
Rank 1
Lini
Telerik team
Share this question
or