sitecoresitecore7sitecore7.2glass-mapper

GlassMapper GetHomeItem<T> always returning null


I have been using GlassMapper for a long time, and this piece of code has always worked flawlessly; today, after playing with the children of the Home item it no longer works - even if I undo my changes.

On Internet I found no documentation for this method and its failed states - under which circumstances I should be unable to retrieve the wrapper of the website root item?

The line in question is:

var root = new SitecoreContext().GetHomeItem<MenuPage>();

Solution

  • This method retrieves home item using data from your current site. You should check: