CodeBetter CAPTCHA Modification

I used TrimothyHumphrey's CAPTCHA for anti-spam-comment in this blog.  These days, I am trying to upgrade my blog system from Community Server 2.1 to Community Server 2007. It seems I need a new CAPTCHA component.

After a short survey in Google, I found the CodeBetter CAPTCHA may be the best one.  No need to modify any source code of CS2007, no need to modify any aspx or ascx!  What I have to do is only to set web.config and add proper control adapter to set default.browser  for specific comment/post editior control, then it will find the submit button automatically and insert a CAPTCHA check before it.
(ASP.NET 2.0 control adapter seems another cool thing I didn't know. Damn, how many good things did I miss?)

I found it doesn't work on anonymous forum post submit and I found someone posted the same problem about CommunityServer.Discussions.Controls.CreateEditForumPostForm in Brendan's blog but still got no answer.

After a little digging in source code, I found the cause is that the submit button of forum post editor is named as 'PostButton' and it's not in the submit button searching list.  So modify the code list this, you will see the CAPTCHA shining in forums area... Cool!!

Thanks to Brendan, this CAPTCHA is really fancy!

//Modify CaptchaControlAdapter.cs
// find the submit button
Control c = CSControlUtility.Instance().FindControl(form, "btnSubmit");
 
//2007-11-10 by Jeffrey, 
//For CommunityServer.Discussions.Controls.CreateEditForumPostForm
if (c==null)
    c = CSControlUtility.Instance().FindControl(form, "PostButton");
 
if(c == null)
    c = CSControlUtility.Instance().FindControl(form, "CreateAccount");
歡迎推文分享:
Published 11 November 2007 01:07 AM 由 Jeffrey
Views: 33,641



意見

沒有意見

你的看法呢?

(必要的) 
(必要的) 
(選擇性的)
(必要的) 
(提醒: 因快取機制,您的留言幾分鐘後才會顯示在網站,請耐心稍候)

5 + 3 =

搜尋

Go

<November 2007>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
 
RSS
創用 CC 授權條款
【廣告】
twMVC

Tags 分類檢視
關於作者

一個醉心技術又酷愛分享的Coding魔人,十年的IT職場生涯,寫過系統、管過專案, 也帶過團隊,最後還是無怨無悔地選擇了技術鑽研這條路,近年來則以做一個"有為的中年人"自許。

文章典藏
其他功能

這個部落格


Syndication