Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

SiteDefinition.Current.SiteUrl returns null

EPiServer.Web.SiteDefinition.Current.SiteUrl returns null from background thread unless there is wildcard site definition.

Version: EPiServer.CMS.Core.7.13.1

Is this fixed in later versions? If not, are there plans to fix it or wildcard site mapping is a mandatory thing?
Maybe this behaviour is by design? if so then:

this and similar needs to be fixed:
public static string AbsoluteUrlBySettings(string path)
      return UriSupport.Combine(UriSupport.SiteUrl.GetLeftPart(UriPartial.Authority), UriSupport.ResolveUrlBySettings(path));

The same is mentioned here:
Feb 12, 2015 13:50

I had the same problem while trying to set different DisplayOptions for different sites for ContentAreas. I was trying to do this from an IInitializableModule but the sitename was not know at this point and if I used wildcard on one of my sites it allways returned that one site.

So i had to move my DisplayOption initialization to a later stage in the startup where sitename is known. I'm not happy with this solution and would rather have my initializations in initialization modules.

Mar 05, 2015 10:04
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.