Error! The requested URL returned 500 - Internal Server Error

Posted: July 12, 2012 at 3:49 AM Quote #73829
My testimonials section I have created I keep getting

Error! The requested URL returned 500 - Internal Server Error

It based on the news section with some modifications any one any ideas why I am getting this error, it only happening in the admin section I can post comments to the testimonials with out a problem.

But when I try to access the comments I keep getting this error!!!!!!
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: July 12, 2012 at 4:24 AM Quote #73832
500 errors are mostly caused by bugs in your code. Can you post the code?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: July 12, 2012 at 4:29 AM Quote #73833
Here is the code:

[HttpPost, GridAction(EnableCustomBinding = true)]
        public ActionResult Comments(int? filterByNewsItemId, GridCommand command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews))
                return AccessDeniedView();

            IList<TestimonialsComment> comments;
            if (filterByNewsItemId.HasValue)
            {
                //filter comments by news item
                var newsItem = _TestimonialsService.GetTestimonialsById(filterByNewsItemId.Value);
                comments = newsItem.TestimonialsComments.OrderBy(bc => bc.CreatedOnUtc).ToList();
            }
            else
            {
                //load all news comments
                comments = _customerContentService.GetAllCustomerContent<TestimonialsComment>(0, null);
            }

            var gridModel = new GridModel<TestimonialsCommentsModel>
            {
                Data = comments.PagedForCommand(command).Select(newsComment =>
                {
                    var commentModel = new TestimonialsCommentsModel();
                    commentModel.Id = newsComment.Id;
                    commentModel.TestimonialsItemId = newsComment.TestimonialsItemId;
                    commentModel.TestimonialsItemTitle = newsComment.TestimonialsItem.Title;
                    commentModel.CustomerId = newsComment.CustomerId;
                    commentModel.IpAddress = newsComment.IpAddress;
                    commentModel.CreatedOn = _dateTimeHelper.ConvertToUserTime(newsComment.CreatedOnUtc, DateTimeKind.Utc);
                    commentModel.CommentTitle = newsComment.CommentTitle;
                    commentModel.CommentText = Core.Html.HtmlHelper.FormatText(newsComment.CommentText, false, true, false, false, false, false);
                    return commentModel;
                }),
                Total = comments.Count,
            };
            return new JsonResult
            {
                Data = gridModel
            };
        }
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: July 12, 2012 at 4:31 AM Quote #73834
Here the other bit of code
public ActionResult Comments(int? filterByNewsItemId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews))
                return AccessDeniedView();

            ViewBag.FilterByNewsItemId = filterByNewsItemId;
            var model = new GridModel<TestimonialsCommentsModel>();
            return View(model);
        }
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: July 12, 2012 at 4:52 AM Quote #73835
Very odd I removed the following line and it now works

//commentModel.TestimonialsItemTitle = newsComment.TestimonialsItem.Title;

Odd!
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: July 12, 2012 at 4:55 AM Quote #73836
Maybe TestimonialsItem is null?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: July 12, 2012 at 12:57 PM Quote #73892
Not sure but it working now and that all that matters, saying that not sure if we are going to use the comments section. It there and working if we are but other wise it not a big worry now.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.
eCommerce CONFERENCE 2018
Learn more