I am using Um开发者_JAVA百科braco 4.7. We are hosting multiple websites in a single installation. Is there any way to get all domain names as a list.
Mahesh
The umbraco.library method GetCurrentDomains() should do what you're after.
http://our.umbraco.org/wiki/reference/umbracolibrary/getcurrentdomains
public void GetDomains()
{
try
{
Node parent = new Node(-1);
foreach (Node child in parent.Children)
{
Domain[] domains = library.GetCurrentDomains(child.Id);
if (domains != null && domains.Length >= 0)
{
foreach (Domain d in domains)
{
Response.Write(d.Name.ToString() + ";");
}
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message.ToString());
}
}
Got the answer from this link
精彩评论