This project is read-only.

Admin Comment API returns a 500 status with invalid 'type' URL

Topics: Business Logic Layer
Jul 30, 2014 at 11:24 PM
Edited Jul 30, 2014 at 11:26 PM
Comments tab does not load in our admin section. In Google error console I see an angular JS status 500 error for the URL...

http://localhost/blog/api/comments?filter=&order=&skip=0&take=0&type=5 .

I also see a "Error Loading Tags" popup in the browser. We have 2700 or more rows in the be_posttags table.

Debugging a bit I've found that the issue is with the 'type' URL parameter. E.g...
http://localhost/blog/api/comments?filter=&order=&skip=0&take=0 .
The above URL works ( i.e. I removed 'type' URL parameter )

Also if I set type URL parameter to '1' or '2' then it works and returns valid XML. An empty type with 'type=' and no value also works. Type of '0' returns valid XML but it is an "<error>" XML tag.

I suspect this maybe a data problem. It is an upgraded blog install. Upgraded from 2.0 version.

Any idea how to solve this? How do I get the 'type=5' to stop throwing that status 500.

Alternatively, is there a way I can get the full stacktrace dump for the 500 error without building from source?
Jul 31, 2014 at 1:32 AM
You can download source code and replace "app_data" folder with your own (or point to your database if using DB provider). Then just run in debug mode.
Jul 31, 2014 at 7:12 PM
Edited Jul 31, 2014 at 7:13 PM

I'm tracking down the comment API 500 status error and I believe I've found it.

The application does not expect 'null' for the profile email. Checking the profile email for null or whitespace fixes the issue.
diff -r AuthorProfile.cs AuthorProfile1.cs
<                 Profiles.Find(p => String.IsNullOrWhiteSpace(p.EmailAddress) ? false : p.EmailAddress.Equals(email, StringComparison.OrdinalIgnoreCase));
>                 Profiles.Find(p => p.EmailAddress.Equals(email, StringComparison.OrdinalIgnoreCase));

Marked as answer by ralphlaw on 7/31/2014 at 11:13 AM