Mahesh KP
Mahesh KP

Reputation: 6446

Domain names list in umbraco

I am using Umbraco 4.7. We are hosting multiple websites in a single installation. Is there any way to get all domain names as a list.

Mahesh

Upvotes: 1

Views: 3706

Answers (2)

Mahesh KP
Mahesh KP

Reputation: 6446

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

Upvotes: 1

Tim
Tim

Reputation: 4410

The umbraco.library method GetCurrentDomains() should do what you're after.

http://our.umbraco.org/wiki/reference/umbracolibrary/getcurrentdomains

Upvotes: 1

Related Questions