Virtual Happy Hour is canceled this month (March) due to Good Friday.
Try our conversational search powered by Generative AI!
AI OnAI Off
Virtual Happy Hour is canceled this month (March) due to Good Friday.
Since a scheduled job is outside the Context, Episerver don't know WHICH start page you'd be referring to in case you'd have a multi site setup, and which language.
Check the SiteDefinitionRepository
var siteDefinitionRepository = ServiceLocator.Current.GetInstance<SiteDefinitionRepository>(); var siteDefinitions = siteDefinitionRepository.List().ToList(); foreach (var siteDefinition in siteDefinitions) { ... }
Check what you can do with the SiteDefinition here. For example siteDefinition.StartPage
http://world.episerver.com/documentation/class-library/?documentId=cms/10/D08CD219
I have a scheduled task that requires a reference to the start page, but ContentReference.StartPage is null in this situation.
From what I have seen other people get round this by putting * in as host - but I am pretty sure the client is not going to go for that on prod and anyway it feels like a bodge (workaround for bad code).
What is the correct way to get a reference to the start page in this situation?