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 @ 07:45
    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.

  • Daniel Bardi 927 posts 2562 karma points
    Mar 22, 2011 @ 07:54
    Daniel Bardi
    0

    Sections are available based on user rights.  Hostnames don't play into section authorization.

    You could write code to filter that.

    Hope I understood that... if not please explain what you mean by "get all the hostnames installed"

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

    Hi Daniel,

    Actually we are hosting multiple websites in a single installation and i want to get all the host names assigned.

    Me want something like this described in http://our.umbraco.org/forum/developers/api-questions/9606-get-hostname(s)

    But umbraco.cms.businesslogic.web.Domain.GetDomains() is not working. I can't find a method like GetDomains().


     

  • Pasang Tamang 258 posts 458 karma points
    Mar 22, 2011 @ 08:24
    Pasang Tamang
    0

    Hi mahesh

    Please look on this post http://our.umbraco.org/forum/developers/extending-umbraco/18643-Get-all-host-name. May be this will help you


  • Daniel Bardi 927 posts 2562 karma points
    Mar 22, 2011 @ 08:27
    Daniel Bardi
    0

    GetDomains() is an internal method.

    Here's the code:

    internal static List<Domain> GetDomains()
    {
        return Cache.GetCacheItem<List<Domain>>("UmbracoDomainList", getDomainsSyncLock, TimeSpan.FromMinutes(30.0), delegate {
            List<Domain> list = new List<Domain>();
            using (IRecordsReader reader = SqlHelper.ExecuteReader("select id, domainName from umbracoDomains", new IParameter[0]))
            {
                while (reader.Read())
                {
                    string domainName = reader.GetString("domainName");
                    int id = reader.GetInt("id");
                    if (list.Find(d => d.Name == domainName) == null)
                    {
                        list.Add(new Domain(id));
                    }
                    else
                    {
                        Log.Add(LogTypes.Error, User.GetUser(0), -1, string.Format("Domain already exists in list ({0})", domainName));
                    }
                }
            }
            return list;
        });
    }

     

  • mahesh 12 posts 34 karma points
    Mar 22, 2011 @ 09:47
    mahesh
    0

    Hi Daniel ,

     

    Me got answer http://our.umbraco.org/forum/developers/extending-umbraco/18643-Get-all-host-name

    thanks for your reply


     

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies