I took Jeff Atwood's CAPTCHA example and added a new event called "UserValidationEvent"
Public Event UserValidationEvent As EventHandler
Then I raise the event at the VERY end of ValidateCaptcha I raise it:
RaiseEvent UserValidationEvent(Me, New EventArgs)
I made it a separate event because I want the CaptchaControl to integrate with my blogging software WITHOUT any code on the server side. I didn't want to have to recompile dasBlog or check anything in the Page_Load.
I made the appropriate web.config changes as per Jeff's instructions, and I added the control to the CommentViewBox.ascx and put this code at the top:
<%@ Register TagPrefix="cc1" Namespace="WebControlCaptcha" Assembly="WebControlCaptcha" %>
<script Language="C#" Runat="Server">
protected void Foo(object sender, System.EventArgs e)
{
if (Page.IsPostBack == true && CaptchaControl1.UserValidated == false)
{
Response.Redirect(Request.RawUrl);
}
}
protected void Page_Load(object sender, System.EventArgs e)
{
//Ya, ya, I know I could have hooked this event up a number of ways
// including AutoEventWireUp but I like this fine, and it feels
// more explicit to moi.
CaptchaControl1.UserValidationEvent += new EventHandler(Foo);
}
</script>
There are a few Font issues to work out...he has it setup with a number of "no-no" fonts, while I'd prefer a list of "allowed" fonts.
Tracked by:
http://hyperthink.net/blog/PermaLink,guid,a263f250-0d90-4b56-93f7-b27391cdf0c8.a... [Pingback]
http://www.hanselman.com/blog/PermaLink.aspx?guid=8c8cbf02-b25f-4170-9e68-110afd... [Pingback]
"dasBlog: Update von 1.6 aud 1.7 - So gehts" (thomas woelfers blog) [Trackback]
"WikiSpam" (shahine.com/omar/) [Trackback]
"Not Much on My Mind Right Now" (George V. Reilly's Blog) [Trackback]
http://localhost/home/blogs/test/archive/2004/11/15/10408.aspx [Pingback]
http://localhost/home/blogs/neo/archive/2004/11/15/8853.aspx [Pingback]
"Not Much on My Mind Right Now" (George V. Reilly's Blog) [Trackback]
"Not Much on My Mind Right Now" (George V. Reilly's Technical BLog) [Trackback]