Captcha Image Fails to Render on a load balanced

2 posts, 0 answers
  1. Aslam
    Aslam avatar
    9 posts
    Member since:
    Dec 2010

    Posted 16 Aug 2012 Link to this post


    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


  2. Slav
    Slav avatar
    1351 posts

    Posted 21 Aug 2012 Link to this post

    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top