Try our conversational search powered by Generative AI!

SiteDefinition.Current.SiteUrl returns null

Vote:
 
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:
EPiServer.UriSupport:
public static string AbsoluteUrlBySettings(string path)
    {
      return UriSupport.Combine(UriSupport.SiteUrl.GetLeftPart(UriPartial.Authority), UriSupport.ResolveUrlBySettings(path));
    }



The same is mentioned here:
http://world.episerver.com/Forum/Developer-forum/-EPiServer-75-CMS/Thread-Container/2014/4/Problem-with-export-of-content-items/
#117159
Feb 12, 2015 13:50
Vote:
 

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.

#118372
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.