开发者

Domain names list in umbraco

开发者 https://www.devze.com 2023-02-18 17:42 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消