In my code, I'm trying to access the root path for the current site.
Let's say I'm accessing my website http://mywebsite
.
Here is the site definition:
<site
patch:before="site[@name='website']"
name="SomeSite"
hostName="mywebsite"
rootPath="/sitecore/content/Somesite"
startItem="/home"
database="master"
loginPage="/login"
...
/>
When I try to get the root path, all methods I've tried return /sitecore/content
. What I want to get is /sitecore/content/Somesite
, which is what I've specified on the site definition.
I tried the following:
Sitecore.Context.Site.RootPath
foreach(var site in Sitecore.Configuration.Factory.GetSiteInfoList())
Sitecore.Context.Site.ContentStartPath
(which returnsnull
)
Is there something I'm missing, like passing the current hostname or something that can pick the complete root path?