This blog post is based on a real life issue, that we experienced on our site once.
In the header of out Sharepoint masterpage we had inserted 2 AuthoringContainer controls with a plan for adding two different stylesheets to the page. One stylesheet used for Reader and another for Editors. This seemed pretty straightforward to achieve using the DisplayAudience property on the AuthonringContainer.
It can have the 2 values
So adding two authoring containers and setting that property to match each scenario seemed like the right way to go, and everything worked as expected.
The one day we received information that the page looked strange in certain scenarios for some pages. After some debugging we found a common pattern for the urls, as the urls that not displaying correctly looked like this
The patthern for these urls is that they are in a format the ends in /filename.fileextension/urlextension. This last part of the url can be retrieved in .NET using HttpRequest.PathInfo and as such it is a known format. The problem with this format is that whenever something is added to the url like this Sharepoint is not able to properly set SPContext.Current.ListItem and by default the AuthoringContainer is not displayed if there is no current listitem.
Very simply you can set the property RequireListItem to false and the it works as expected, so the tag looks like this
<PublishingWebControls:AuthoringContainer ID="AuthoringContainer1" DisplayAudience="ReadersOnly" RequireListItem="false"