Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mahesh 12 posts 34 karma points
    Mar 22, 2011 @ 06:24
    mahesh
    0

    Get all host name

    Hi,

      I am using umbraco 4.7. We are hosting multiple websites in a single installation. So in a cutom section me want to get all the hostnames installed.

     

  • Pasang Tamang 258 posts 458 karma points
    Mar 22, 2011 @ 08:06
    Pasang Tamang
    1

    Hi mahesh

    Try this code once. This code will return all the domain names assign for top node.

            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());
                }
            }
    

    Hope this will help you.

    Pnima

  • mahesh 12 posts 34 karma points
    Mar 22, 2011 @ 08:40
    mahesh
    0

    Thanks Pnima. It solved my problem 

  • Daniel Bardi 927 posts 2562 karma points
    Mar 22, 2011 @ 09:50
    Daniel Bardi
    0

    That'll do it!  Great answer

Please Sign in or register to post replies

Write your reply to:

Draft