November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi,
There is SiteDefinitionRepository that you could resolve in ServiceLocator:
var siteDefinitionRepository = ServiceLocator.Current.GetInstance<SiteDefinitionRepository>(); var siteDefinitions = siteDefinitionRepository.List().ToList(); foreach (var siteDefinition in siteDefinitions) { var siteURl = siteDefinition.SiteUrl; foreach (var hostDefinition in siteDefinition.Hosts) { var uri = hostDefinition.Name; } }
Hi,
I think, that you can get hosts wihtout SiteDefinitionRepository.
You should use class SiteDefinition from namespace EPiServer.Web.
For exmaple:
EPiServer.Web.SiteDefinition.Current.Hosts
results:
Count = 7
[0]: localhost, sv
[1]: localhost:1111, sv
[2]: *
[3]: www.myproject.pl, pl
[4]: www.myproject.no, no
[5]: www.myproject.se, sv
[6]: www.myproject.com
Best Regards
Hi,
Can anyone tell me how to get list of websites that are configured in Admin/Config/Manage Websites?
Thank in advance,
Linh