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;


Comments

Be the first to post a comment

Post a comment


90 - 44 =