So, spent some time trying to figure this out and I got to this:
In sitecore.config there is a section where you define your websites. While I was trying to setup a custom login page I added "loginPage" attribute to "website" site element but it didn't work.
At one point I realized that I have to change the name from "website" to "myhost_name" and the login page started to work as expected but it turns out that removing the "website" site element wasn't a very bright idea because the website started to have this unstable behavior.
Does anyone know what's the right setup for this situation? I don't find the Sitecore documentation to clear in this matter.
I have the following issue (I'm kind of new in Sitecore development so it might be some easy stuff, but I can't figure it out)
I have a template for some error messages I will show in the website and I have a folder under content where I store this Items
There are 3 fields I added on template:
All of them are Single Line Text
Now, in visual studio I have a routine which does this:
/// Get an Item by path
public Item GetItemByPath(string itemPath)
And I have an other one which should return a ViewModel
public ModelValidation GetMessageByName(string itemName, string xpath)
var mess = GetItemByPath(xpath + itemName);
if (mess == null) return new ModelValidation(3, itemName);
string stype = "";
string message = "";
if (mess.Fields["Type"] == null)
stype = "3";
stype = mess.Fields["Type"].Value;
if (!int.TryParse(stype, out type))
type = 3;
message = itemName;
message = mess.Fields["Message"].Value;
return new ModelValidation(type, message);
The item is returned, all the fields are in place, but the value of my fields is "" (String.Empty)
What am I doing wrong ?
The items have values in Sitecore and they are published ( I checked the Web database)
VS 2013 MVC 5.2.3
Below are the possibilities of getting the empty results.
try to change your query into: return Sitecore.Context.Database.GetItem(itemPath, Sitecore.Context.Language); If you didn't specify the language the returned item can be in different language than you have in context and because of that your data is empty.
Best regards, Łukasz Skowroński
Thank you all for your advices. The problem was that there was an other site config file . Stil does not explain the unexpected behavior but at least I solved the issue.