Thursday, February 01, 2007 - Posts

KB-TimothyHumphrey CAPTCHA causes post preview error

I added TimothyHumphrey's CAPTCHA web control to CS2.1 forum post editor to prevent from spam-post.  A friend told me, when he wrote a post in anonymous, press preview tab will cause a AJAX error.  After tracing request and response with Fiddler, I found the Validate() method of TimothyHumphrey.WebControl.Captcha throw a null reference exception.  Dig deeper, the request contain several Ajax_blah post variables, and I guess that TimothyHumphrey's CAPTCHA doesn't behave normally duration AJAX post back model.  After modified Validate() method to skip checking when Request["Ajax_CallBackMethod"] is detected, it seems OK now.

TimothyHumphrey.WebControl.Captcha.cs

  519         public void Validate() {

  520             //2007-02-01 Modified by Jeffrey Lee

  521             //Skip the validation while AJAX preview

  522             if (this.Context.Request["Ajax_CallBackMethod"] != null)

  523                 return;

  524 

  525             HttpCookie cookie = this.Context.Request.Cookies[CaptchaImagePage.CookieName];

  526             bool valid;

Search

Go

<February 2007>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728123
45678910
 
RSS
【工商服務】


BlogLook Score and Rank

Syndication