unable to save a comment

Topics: ASP.NET 2.0, Controls
May 26, 2009 at 11:47 PM

Hello,

I have blogengine as a subdirectory of my existing website. I have SQL Server has my data storage and I am able to visit all the other pages and everything seems to work fine.

But I am unable to save a comment to a blog. When I give all the necessary input and click on "Save comment",  the "saving comment" image keeps on going and the comment does not get saved.

I am stuck with this issue, please help me out.

 

Thanks

Coordinator
May 26, 2009 at 11:53 PM

Do you have the Akismet extension installed?  If so and you haven't yet put in your Akismet API credentials into the extension, that would be a possible cause for this.

If that's not the case, if you could post the URL to your blog here or PM me, I or someone else could take a quick look to see what the problem could be.

May 27, 2009 at 12:34 AM

Thanks for getting back so quickly.

I am having a fresh install of Blogengine 1.5. I do not know what Akismet means? Does it come along with Blogengine?

I am within a firewall so you would not able to view the site :(

I tried changing the datastorage to Xml and even then this weird thing is happening.

Thanks

Coordinator
May 27, 2009 at 7:09 AM

Akismet doesn't come with BE.  And since you've done a fresh install of BE 1.5, I'm sure you don't have the Akismet extension.

After you try adding a comment, and it appears to hang, if you refresh the page, is your comment there?

Are you using IIS7 or IIS6?  Are you using the web.config file that comes with BE 1.5?

Does the comment Preview work?

May 27, 2009 at 8:34 AM

It might work checking you have write permissions on the app_data folder.

The other days(I have my blog hosted with godaddy on Win 2008), the permissions on my app_data folder were reseted somehow(godaddy rox), and when I went to my blog in the morning, I've noticed some new comments, at least according to the number of comments for some posts(these comments did not show on the posts) and the recent comment widget, but the comments were not saved in the post xml files(I use XML provider).

I've tried to post a test comment, and it was just keep saying comments and nothing(like it was hanging or so).

I've checked the permissions on the app_data folder, and surprise.

I've restarted the application(deleting the web.config file and uploading it again) and those comments were "flushed"(I've manually edited the posts to re-add them).

Cheers!
Adrian

May 27, 2009 at 5:17 PM
Edited May 27, 2009 at 5:19 PM

Hello,

Thanks for your responses.

I am using IIS 6 and yes I am using web.config which comes with BE 1.5.

Even when I do the preview the "saving comment" image just stays there and the comment does not come up after I do a refresh.

I am using SQL Server data storage completely , even in this case should I give write permissions to my App_Data folder?

I started digging down into the code and came across a ajax callback happenning which posts the information which is the author name, email, website etc to the server side code from the client & suprisingly when I tried to debug on the server side, these parameters were returning null.

Then i checked the blog.js script which has the function "AddComment" that gets invoked when the user clicks on Save Comment button. These below lines,

var author = BlogEngine.comments.nameBox.value;
 
var email = BlogEngine.comments.emailBox.value;
 
var website = BlogEngine.comments.websiteBox.value;

were generating an error " BlogEngine.comments.nameBox.value is null or not defined" this makes the value go null when it enters the RaiseCallBack method on the server side.

Does this ring any bells for anyone???

Thanks

 

Coordinator
May 27, 2009 at 9:00 PM
Edited May 27, 2009 at 9:02 PM

A couple of possibilities ...

The blog.js file is maybe not getting loaded in the browser.  Do a View Source when you're on your blog and do a Find for "blog.js".  It's going to be in a <script> tag, and probably served with the JS.AXD handler.  So the <script> tag will look something like:

<script type="text/javascript" defer="defer" src="/js.axd?path=%2f%2fblog.js&amp;v=1.5.0.7"></script>

You can try navigating in your browser directly to that URL to see if it comes up.  If the blog is in the root of a website, the URL will be something similar to:

http://YourServer/js.axd?path=/blog.js

If the blog is in a sub-folder or in a sub-application, the URL will be similar to:

http://YourServer/Folder/js.axd?path=/Folder/blog.js

Try navigating to the URL to see what comes up.

On a related note, can you pull up the RSS feed for the blog?  Any errors?

EDIT:  On second thought, the blog.js file is probably getting loaded in the browser ... otherwise you wouldn't be getting the "BlogEngine.comments.nameBox.value is null or not defined" error.

Also, while you're on the page where you would leave a comment, do a View Source there too, and do a Find for "registerCommentBox".  It should be a function containing the IDs of a bunch of controls (like BlogEngine.comments.emailBox, BlogEngine.comments.websiteBox, etc).

If you're getting a 404 error for the JS.axd URL above, and also a 404 error for the RSS feed, this would probably be because your site/application in IIS6 has the option selected that says "A file must exist" for the .AXD file extension.  You would want to make sure IIS6 doesn't require the .AXD extension to physically exist.  Here's some instructions on how to find this setting I just recently gave someone ...

In IIS6, if you right-click on your web application (or web site), select Properties, on the Home Directory (or Virtual Directory) tab, there's a "Configuration..." button.  Clicking that will bring up a list of Application extension mappings.  It has extensions like .html, .ascx, .aspx, axd, .shtml, etc.  For the .AXD and .ASPX extensions, if you highlight them one at a time, and click the Edit button, there's a checkbox on the window that comes up lableled "Verify that file exists".  Make sure that is unchecked for the .ASPX and .AXD extensions.

May 29, 2009 at 8:10 PM

 

Hello,

Everything seems to be fine , I am not getting any 404 error while navigating to that URL.

The comment gets posted fine, if I run blogengine as the root application. But It does not when I have blog as a sub directory within another application.

I tried debugging into the javascript stuff and when I checked out the reponse text of the XMLHTTPRequest object after the send method was executed , I got this "eThe target 'ctl00$cphBody$CommentView1' for the callback could not be found or did not implement ICallbackEventHandler" with a readystate of 4. But i checked the CommentView.ascx file and it does implement the handler.

I am really confused now. I am not familiar much with the parent application into which i am integrating this blogengine as a sub directory. I merged the web.config file of the both blogengine and my parent app & kept the web.config in the root.

Is there any specific assembly file which it needs?

Thanks

Coordinator
May 29, 2009 at 8:28 PM

The easiest thing to do when putting BE into a sub-folder is to mark that sub-folder an an application, or application starting point in IIS.  By doing this, you don't need to integrate any of the BE files into the root folder.  The BE sub-folder will run as its own application.

Jun 2, 2009 at 8:20 PM

Check out this link:

http://blogengine.codeplex.com/WorkItem/View.aspx?WorkItemId=9116

I had the exact same problem and this fixed it for me.  The web.config file of the parent directory had legacy enabled, which was screwing with AJAX and keeping the BE comments from posting.  Once I removed <xhtmlConformance mode="Legacy"/> from the parent directory config file it worked perfectly.  Hope this helps!

Jun 2, 2009 at 8:35 PM

Thanks Chris. That worked like a charm. :)

Jun 21, 2009 at 4:29 PM
Edited Jun 21, 2009 at 9:35 PM

Another Solution: Fix the Hard Coding in the blog.js file.

blog.js has the following line of code with the Hard Code place holder. Well that works fine on my local PC...

WebForm_DoCallback('ctl00$cphBody$CommentView1', argument, callback, 'comment', null, false);

The name on the server is....

WebForm_DoCallback('_ctl0:cphBody:CommentView1', argument, callback, 'comment', null, false);

So to save time I just changed the Hard Coded value to match the server, and FTP the .js file to the server and now all is well.

There is nothing as quite as fun as chasing down an issue to find out it was a Hard Coding feature that caused the problem.

MTR Investors Group

 

Jun 21, 2009 at 11:04 PM

Well it appears my prior post fixed the issue but there is something else going on.

The Post Comment works. Then going back to the site typing in a post I get "Saving the comment..."  just sitting there. I clear the cache, go back, it works, try again it does not...