This project is read-only.

JavaScript error when posting comments

May 11, 2010 at 8:31 AM
Hi all! One of my readers pointed out to me today that it is not possible to comment my blog posts om and he is correct. But, if I download the whole site and run it localy on my computer (you can test it here then it works. The error I get is "'BlogEngine' is undefined' on row 458 in WebResource.axd and on row 1 in js.axd. Anyone know what this is about? Thanks in advance.
May 11, 2010 at 5:04 PM

Make sure you haven't removed a div tag you need on accident in the postview aspx file. I did this and spent 2 weeks figuring out what was causing comments not to work.

May 11, 2010 at 5:49 PM
Edited May 11, 2010 at 5:54 PM
Well, the strange thing is that it works locally, but not on my web host... Any ideas about that? EDIT: Ok, so I set up the blog locally on , that is without the bloge2/ subfolder, and it still works fine on my local computer.
May 11, 2010 at 5:54 PM

Are you in debug mode when doing it locally?

May 11, 2010 at 5:58 PM
Seems I was, debug argument for compilation tag in web.config was set to true. i will try setting it to false both online and localy.
May 11, 2010 at 6:01 PM
Well, that didn't make a difference... :(
May 17, 2010 at 7:59 AM

Is there no one that have experienced the same problem?


It might be something with my webhost maybe, since it works at home?

May 20, 2010 at 9:34 AM

For some mystical reason it stopped orking on my local computer too.

So I rewrite the comment posting part not to use AJAX, but postback instead.

May 22, 2010 at 9:55 PM
Edited May 22, 2010 at 10:12 PM

So, I've updated to, still the same problem, it is working locally but not on my webhost.

Also, the search functions isn't working either.

Is it seriously no one else who could help me out?

So, the problem seems to be in js.axd, on my webhost it returns nothing when trying to link in blog.js; but on my local-computer it works fine, and also comment posting and searching is working locally;

Any ideas?

May 23, 2010 at 12:44 AM

First, is the blog.js file physically in the root folder?  If I try to navigate to:

It's a 404.

Second, assuming blog.js is there (somewhere), the first line in blog.js is:

// global object

Try removing (deleting) that line.  You may need to restart the blog for changes to take effect (because the contents of blog.js might be cached in memory).  You can restart the blog by making any change to the web.config file (add a space, etc).

May 23, 2010 at 8:58 AM

Thank you BenAmada!

Removing the först line with the comment in blog.js did the trick!

(Also I had ben fideling a bit last night and forgot to upload blog.js again that's why you couldn't see it, but it is there now).

But, I would like some sort of explanation to this, how come it doesn't work with the comment?

Thanks again!

May 23, 2010 at 10:44 AM

That's good news.  I'm not sure the exact reason why removing the first line works.  Some others in the past had the same problem, and removing the first line fixed it.

The first line is a JS comment -- it begins with two forward slashes.  One possible reason for the problem may be that when BE reads in that file, the built-in .NET functions that read the file are interpreting those two slashes as being some type of file "preamble" characters -- like BOM (byte order mark) characters -- rather than treating the two forward slashes as actual content.  And either it breaks there, or the two forward slashes get discarded (as they're considered not actual file content, but "header" info), and then the file ends up beginning with "global object" (without the two forward slashes) ... but this ends up with the JavaScript contents being invalid since you now have the file beginning with a syntax error.

This is just some ideas off the top of my head.  I haven't looked into it ... mostly because I'm not having this problem myself with blog.js ... so I can't easily reproduce it.

May 24, 2010 at 10:09 AM
All of those seem very plausible for me :) Anyway, thank you again.