Comments Issue: 'There was an error in the callback'

Topics: Controls
Apr 29, 2015 at 9:08 AM
Hi,

I'm having an issue when comments are posted on my blog, i'm getting this error - 'There was an error in the callback'. I've read that this could be due to the Recaptcha, which I have now disabled, but I still get the error.

I'm using BlogEngine.net 2.0.0.36, any help would be appreciated.

Thanks
Apr 29, 2015 at 8:14 PM
Edited Apr 29, 2015 at 8:15 PM
Had same message occurring with ver 2.0.0.47 a few months back, fixed it and forgot about it until now.
I was, still am using simple captcha (rather than Recaptcha).
What I do remember is that the browser's JavaScript console gave big clues to what was going wrong and remember tinkering with blog.js in the Scripts folder.
If you are able to post a link to your blog, will take a look and see if it jogs the memory, but the Browser's JavaScript Console is a good place to start troubleshooting.

Speaking of captchas, is it just me or is the one on this forum particularly hideous.
May 1, 2015 at 12:26 PM
Thanks for your reply Andy, i've never been a big fan of captchas, but i agree this one is particularly bad!

Here's a link to my blog anyway, http://www.cpltraining.co.uk/philmellows/post/2015/04/28/On-beards-and-beers.aspx#comment

I've checked the console but unfortunately i don't get any errors back which is a bit frustrating...
May 1, 2015 at 4:58 PM
Unfortunately I'm not seeing anything in the console either.
Fortunately, I do have a copy of your BE version.

Open up AkismetFilter.cs in your App_Code/Extensions folder.
Look for following method and make the commented changes(change 1 and 2).
private string HttpPost(string url, string data, string charset)
        {
            var value = string.Empty;

            // Initialize Connection
            var request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "POST";
            request.ContentType = string.Format("application/x-www-form-urlencoded; charset={0}", charset);
            request.UserAgent = this.userAgent;
            request.ContentLength = data.Length;

            // Write Data
            using (var writer = new StreamWriter(request.GetRequestStream()))
            {
                writer.Write(data);
            }

            // Read Response

            /***** Change 1 - Remove this section of code
            var response = (HttpWebResponse)request.GetResponse();
            var responseStream = response.GetResponseStream();
            if (responseStream != null)
            {
                using (var reader = new StreamReader(responseStream))
                {
                    value = reader.ReadToEnd();
                }
            }
            End remove *****/

            /***** Change 2 - Replace with this *****/
            try
            {
                var response = (HttpWebResponse)request.GetResponse();
                var responseStream = response.GetResponseStream();
                if (responseStream != null)
                {
                    using (var reader = new StreamReader(responseStream))
                    {
                        value = reader.ReadToEnd();
                    }
                }
            }
            catch (Exception) { }
            /***** End replace *****/

            return value;
        }
May 1, 2015 at 5:08 PM
Andy you're a hero!

That's fixed it, thanks for your help mate.