Jeremy Davis
Jeremy Davis
Sitecore, C# and web development
Article printed from: https://blog.jermdavis.dev/posts/2015/notes-on-an-annoying-misconfiguration

Notes on an annoying misconfiguration

Published 02 March 2015
Updated 26 June 2018
Sitecore ~1 min. read

I spent a while banging my head against an issue on a client's site last week. Having finally worked out the subtle misconfiguration of that was causing the bug, I thought I should write it down in case anyone else ever suffers the same problem. I figure if I write this down in enough detail, maybe the next person who suffers a related problem won't have to spend as much time Googling as I did...

Issue:

The client reported that on their v6.6 site the Content Editor's Preview button was showing the wrong page, but that the rest of the Content Editor and the Page Editor were working ok. When I investigated in more detail, I found that the Publishing Preview button

Preview Button

was showing the site's homepage rather than the page you had tried to preview. However it was only doing this for some pages on the site. Any page where the "Require Login" security setting had been applied

Require Login

suffered from the issue. But any page which this was not applied to did not show the problem, and would preview fine. Remove this security setting, and the problem went away. Add it to any page and the problem would appear for that page.

Looking in the Sitecore Logs, each attempt to preview a page that showed the wrong result generated an error message. But not a massively helpful one:

4916 03:37:08 ERROR Item could not be found from query string. [ID is "{9F12B247-9671-45E4-9F15-F27D92B74AF2}".]

					

Solution:

The "could not be found" bit lead me off down a blind alley for a while checking to see if the item wasn't missing from databases, or if the querystring ID for the preview page matched the item ID of the thing that was being clicked on in Content Editor. Searching Stack Overflow, the Sitecore Developer Network Forums and other places gave some clues about this, but I didn't find anything describing the particular problem I was seeing. The issue turns out to be down to security configuration:

The config entry for the url being browsed had the attribute domain="extranet in it. Reading around on the internet, when you click the Preview button, Sitecore tries to load the item you selected using the "\anonymous" account – where is the value of the domain attribute from your configuration.

So in this case, Sitecore was trying to run the preview as "extranet\anonymous" – which is exactly the security right that we have denied by clicking "Require Login":

Security Details

So the log error really means "I can't load that item because access is denied". For reasons best known to themselves, the developers who wrote this bit of code seem to have decided that if you can't load an item you should fall back to the homepage item instead of warning the user what's happened.

Changing the domain attribute's value to the correct "sitecore" security domain (the one which editorial accounts live in) fixes the issue.

↑ Back to top