This has been a thorn in my side now for quite some time and I'm glad to say that it's finally been plucked. After pleading and begging the original CAPTCHA control designer to fix the glaring issues with the control and never getting so much as a response nor an acknowledgement of any correspondance, he finally decided to release the source about a month ago. I downloaded it immediately, intent on exploring what the cause of the issues might be, but didn't even crack the .zip until today - it's been that busy.
Well, I dove in to see what the issue was. First of all there were two glaring issues that people constantly complained to me about:
- Users would frequently get a red 'X' image in place of the CAPTCHA image. This actually only happened if the user were to browse to a post on my blog that had a querystring or a hash (such as the #Feedback anchor reference). Even though this was identified as a fixed bug on the source website, I know I'm not alone in continuing to experience it.
- An invalid CAPTCHA code entered would post back and subsequently cause the form to clear and lose all changes and comments made. This was most infuriating.
These issues were the biggest ones. I recompiled and quickly fixed the first issue - not a problem at all. The second one was a little trickier, mostly due to how the control responded to an invalid postback. The control would Redirect back to itself, effectively negating any form content, and thereby clearing out the controls. I saw that Miguel had written and commented out some code that attempted to resolve the issue, but it didn't work (hence it was commented out).
Ultimately, I fixed the control so it would leverage session state (if it is available - .Text blogs have session state off by default and I didn't want to enable it just for a silly control, but wanted to support it if it were present). In the event that session state is not available, a cookie gets created that persists form values until they are posted with a valid CAPTCHA code. There are still a few things that I'd like to address, but it's working MUCH better now. Additionally, I fixed a few more bugs, made the code interfaces a bit cleaner, and tidied up the code where I saw fit. Perf is a little better now too, as well as a few minor memory issues have been resolved.
In the coming posts, I'll be commenting on how I got it to work properly and how I worked around some of the interesting issues in the control.
I'll be submitting my source code back to Miguel here shortly for him to release, seeing that the code is his baby. Hopefully, this makes posting comments on my blog a bit easier. 