示例#1
0
        private Domain GetUmbracoDomain(HttpRequest request)
        {
            // Get the Umbraco request (it may be NULL)
            PublishedRequest pcr = _umbracoContextAccessor.UmbracoContext?.PublishedRequest;

            // Return the domain of the Umbraco request
            if (pcr != null)
            {
                return(pcr.Domain);
            }

            // Find domain via DomainService based on current request domain
            var domain = DomainUtils.FindDomainForUri(_domains, request.Url);

            return(domain);
        }
        private IDomain GetUmbracoDomain()
        {
            // Get the Umbraco request (it may be NULL)
            PublishedContentRequest pcr = UmbracoContext.Current == null ? null : UmbracoContext.Current.PublishedContentRequest;

            // Return the domain of the Umbraco request
            if (pcr != null)
            {
                return(pcr.UmbracoDomain);
            }

            // Find domain via DomainService based on current request domain
            var domain = DomainUtils.FindDomainForUri(Request.Url);

            if (domain != null)
            {
                return(domain);
            }

            return(null);
        }