Post author issue?

Topics: ASP.NET 2.0, Controls, Themes
Feb 4, 2010 at 3:55 PM
Edited Feb 4, 2010 at 4:27 PM

Locally when I click on the authors name all posts by this author are displayed, however on the server it cannot find the page for one of the authors, other authors are displayed without a problem.  Where would I look for this author page locally so I can get it online.

This is weird, online when I change to a different theme the author page works fine, change back to the original theme and it cannot find the page.



Thanks for your help.

Feb 5, 2010 at 4:32 AM

It could be that the theme where errors are occurring is trying to reference an Author's Profile, but a profile doesn't exist, and the code in that theme isn't checking to see if the author's profile is null.

For example, in the Standard theme that ships with BE 1.6, there's this code in PostView.ascx.

Post.AuthorProfile != null ? Post.AuthorProfile.DisplayName : Post.Author

It uses the profile DisplayName if the profile exists, otherwise, it displays the plain old author name.

The theme that is having problems, might just be doing something like:


without checking to see if Post.AuthorProfile is null.

I would search the theme's files for "AuthorProfile".

Feb 5, 2010 at 4:39 AM
Edited Feb 5, 2010 at 4:43 AM

Thank you Ben, but it does work locally in the theme, it just doesn't work on the hosting server with the same theme.

Found this:

 Posted by <a href="<%=VirtualPathUtility.ToAbsolute("~/") + "author/" + Server.UrlEncode(Post.Author) %>.aspx"><%=Post.AuthorProfile != null ? Post.AuthorProfile.DisplayName : Post.Author %></a> |

Feb 5, 2010 at 5:08 AM

When you say it "doesn't work" or it "cannot find the page" for one of the authors, what are you seeing?  An error page, or the homepage and its blank?

Is the data (Users, Profiles and Posts) the same on the local machine as it is on the hosting server?  If the data is different, you could try copying the data from the hosting server to your local server (and restart the blog by making any change to the web.config file, so the latest data is read), and then see if you have the same problem on your local machine.

Does the author's name have any strange characters or spaces in it?

Does the Standard theme work?

Feb 5, 2010 at 1:47 PM
Edited Feb 5, 2010 at 1:49 PM

Receiving this error:

404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

The authors name has a space in it. Jim Terlep

On the server even I create a new post by Jim Terlep and click on his name it returns the same error.


Feb 5, 2010 at 5:18 PM

Do any of the other author's have spaces in their names?

What is the URL in the address bar when you get this error?

This URL on your site works, but maybe it's just working with the Portrait Press theme? Terlep.aspx

This URL works too, when forcing the Standard theme Terlep.aspx?theme=Standard

Feb 5, 2010 at 8:20 PM

Try this one:

This is the one I am testing with 1.6


Thanks for your help.

Feb 5, 2010 at 9:36 PM

I am beginning to think it is the space in the author/username, I have another website http://tucsonbookworms with the same theme and it acts the same when I click on Pat Hammes, same error, when clicking on GaryMason it works fine, although why it works locally with a space and not on the server is beyond me.

Is there some code that would correct this issue I could add somewhere?

Feb 5, 2010 at 10:53 PM

Yes, the space is the problem.  It's getting incorrectly encoded as a + sign.

In PostView.ascx, change this:




After doing this, the URL will then have a hyphen between the name, instead of a plus sign.

Feb 6, 2010 at 2:08 PM
Edited Feb 6, 2010 at 2:19 PM

I changed it to this

Posted by <a href="<%=VirtualPathUtility.ToAbsolute("~/") + "author/" + Utils.RemoveIllegalCharacters(Post.Author) %>.aspx"><%=Post.AuthorProfile != null ? Post.AuthorProfile.DisplayName : Post.Author %></a>


and now receive

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.



I can get to other pages but not to the default page.

Feb 6, 2010 at 2:31 PM


I copied this from the Portraitpress theme and it seems to work in the theme I am having issues with.

<a href="<%=VirtualPathUtility.ToAbsolute("~/") + "author/" + Post.Author %>.aspx"><%=Post.AuthorProfile != null ? Post.AuthorProfile.DisplayName : Post.Author %></a> 

Feb 6, 2010 at 5:26 PM

That's good you got it working.  The code you copied from Portrait Press is simply not doing any coding at all -- and just outputting Post.Author, as-is.

That works.  My guess on the reason for the error on the other piece of code I posted is that Utils needs to be fully qualified:


Both ways work.