2

I'm having a strange issue on Sitecore 8.2. I'm building an IEnuberable<SiteInfo> like this:

sites = SiteManager.GetSites().Select(s => new SiteInfo(s.Properties)).ToList();

What's interesting is that if I inspect the hostname attribute for the website definition on the s.Properties I do see at debug time that the hostname value has the value I have set on the configuration file. in other words it is getting the value from the configuration file but when it is instantiating the SiteInfo the hostname becomes empty. That only happens for the website definition. I have other sites which I tested and they do show the hostname property correctly.

I do see the right hostname defined on the show config page which matches to this:

<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/brands/clientname" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" language="en" patch:source="Client.Brands.ClientName.Project.ClientName.config" itemwebapi.mode="Off" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="false" enableItemLanguageFallback="false" enableFieldLanguageFallback="false" hostname="clientname.dev.local|local.clientname.com"/>

any thoughts on what I might be missing?

8

It's lowercase hostname in your defintion. There must be capital N: hostName. Site attributes are case sensitive.

Should be:

<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/brands/clientname" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" language="en" patch:source="Client.Brands.ClientName.Project.ClientName.config" itemwebapi.mode="Off" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="false" enableItemLanguageFallback="false" enableFieldLanguageFallback="false" 
    hostName="clientname.dev.local|local.clientname.com"/>

You can read more about site attributes in SDN article site Attribute Properties.

  • I knew it was something silly(it always is once you know what`s wrong :p ). Thanks Marek! – Diego Feb 21 '17 at 17:03

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.