Hello,
I'm using Kentico 8.2 as a content platform on domain 'ABC' and MVC project on domain 'XYZ'.
When I call method like...
public ActionResult Index(string path)
{
var alias = DocumentAliasInfoProvider.GetDocumentAliases().Where("AliasURLPath", QueryOperator.Equals, String.Format("/{0}", path ?? String.Empty)).FirstOrDefault();
if (alias != null)
{
var node = DocumentHelper.GetDocument(alias.AliasNodeID, alias.AliasCulture, new TreeProvider());
// ... rest of code
}
}
... everything is properly found from database (alias and node).
node.AbsoluteURL points to proper url so I'm sure that connectionString is configured properly.
Code like:
var aliases = DocumentAliasInfoProvider
.GetDocumentAliases()
.ToList();
properly returns all aliases from Kentico.
The problem is when I want to add below code in this action method, I've got weird results:
var allTreeNodes = DocumentHelper.GetDocuments().ToList(); // returns empty collection (0 results)
var allTreeNodes2 = DocumentHelper
.GetDocuments()
.OnSite(ConfigUtils.Tribes.SiteName)
.ToList(); // returns empty collection (0 results)
var allTreeNodes3 = DocumentHelper
.GetDocuments()
.OnCurrentSite()
.ToList(); // returns empty collection (0 results)
var site = SiteContext.CurrentSite; // returns null
var siteName = SiteContext.CurrentSiteName; // returns ""
var currentSiteID = SiteContext.CurrentSiteID; // returns 0
Do you have any idea why DocumentHelper.GetDocuments().ToList() doesn't return any TreeNode?
Is is connected with fact that SiteContext.CurrentSite returns null?
How SiteContext works (what need to be configured to properly use values from content platform)?
It's strange because on my other Kentico projects those methods returns values and I cannot see why in those case not.
Thanks,
Rafal