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

Captcha Image Fails to Render on a load balanced

1 Answer 90 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Aslam asked on 16 Aug 2012, 01:37 PM

I read that in a load balancing network, the session needs to be out of process

I have a project converting objects to serialize will be a big job.

Is there any other alternative to make this work.
I mean any solution that uses "Inproc" session to work with load balancing


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 21 Aug 2012, 08:26 AM
Hi Aslam,

You can use the following approach - storing the CaptchaImage object in a custom storage medium (for example database), and serving the image via custom HttpHandler. These steps describe the suggested solution:

  1. In the Page.Init event the text code from the CaptchaImage (CaptchaImage.Text) stored in the DB or Session (if any CaptchaImage) is retrieved.
  2. In the Page.Init event an ASP.NET Image control is created, and the ImageUrl is set to the path of the HttpHandler that serves the CaptchaImage. The Image is added to the Page.
  3. A custom HttpHandler (CustomNameSpace.CaptchaImageHandler in my case) that will serve the image is created.
  4. In the web.config, the following markup is added to register the handlers:
            <add path="MyCustom.CaptchaHandler.axd" type="CustomNameSpace.CaptchaImageHandler" verb="*" validate="false"/>
            <remove name="MyCustom_CaptchaHandler_axd" />
            <add name="MyCustom_CaptchaHandler_axd" path="MyCustom.CaptchaHandler.axd" type="CustomNameSpace.CaptchaImageHandler" verb="*" preCondition="integratedMode"/>
  5. The path (highlighted in yellow) can be any path chosen by you.
  6. On a button click the text entered in a TextBox is compared to the one of the CaptchaImage and a respective message is displayed.

I have attached a sample that implements this approach so that you can check it in action and use it as a reference for your further development.

the Telerik team
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 their blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question