0

I have a code that query an alias item like this Sitecore.Context.Database.SelectSingleItem("/page-help") but I get an error saying

End of string expected at position 42.

it only throws this error in my content management but not in my content delivery. How can I fix this in my content management?

Thanks

2

You need to escape the - dashes.

Sitecore.Context.Database.SelectSingleItem("/page#-#help") alternatively Sitecore.Context.Database.SelectSingleItem("/#page-help#")

References:

For simple queries like this however, the following would be eaiser

Sitecore.Context.Database.GetItem("page-help")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.