/// <summary>
        /// Gets the nice url of a published content.
        /// </summary>
        /// <param name="umbracoContext">The Umbraco context.</param>
        /// <param name="id">The published content id.</param>
        /// <param name="current">The current absolute url.</param>
        /// <param name="mode">The url mode.</param>
        /// <returns>The url for the published content.</returns>
        /// <remarks>
        /// <para>The url is absolute or relative depending on <c>mode</c> and on <c>current</c>.</para>
        /// <para>If the provider is unable to provide a url, it should return <c>null</c>.</para>
        /// </remarks>
        public virtual string GetUrl(UmbracoContext umbracoContext, int id, Uri current, UrlProviderMode mode)
        {
            if (!current.IsAbsoluteUri)
            {
                throw new ArgumentException("Current url must be absolute.", "current");
            }

            // will not use cache if previewing
            var route = umbracoContext.ContentCache.GetRouteById(id);

            if (string.IsNullOrWhiteSpace(route))
            {
                LogHelper.Debug <DefaultUrlProvider>(
                    "Couldn't find any page with nodeId={0}. This is most likely caused by the page not being published.",
                    () => id);
                return(null);
            }

            var domainHelper = new DomainHelper(umbracoContext.Application.Services.DomainService);

            // extract domainUri and path
            // route is /<path> or <domainRootId>/<path>
            var pos       = route.IndexOf('/');
            var path      = pos == 0 ? route : route.Substring(pos);
            var domainUri = pos == 0
                ? null
                : domainHelper.DomainForNode(int.Parse(route.Substring(0, pos)), current);

            // assemble the url from domainUri (maybe null) and path
            return(AssembleUrl(domainUri, path, current, mode).ToString());
        }
        internal string GetUrlFromRoute(string route, UmbracoContext umbracoContext, int id, Uri current, UrlProviderMode mode)
        {
            if (string.IsNullOrWhiteSpace(route))
            {
                LogHelper.Debug <DefaultUrlProvider>(
                    "Couldn't find any page with nodeId={0}. This is most likely caused by the page not being published.",
                    () => id);
                return(null);
            }

            if (route.StartsWith("err/"))
            {
                LogHelper.Debug <DefaultUrlProvider>(
                    "Page with nodeId={0} has a colliding url with page with nodeId={1}.",
                    () => id, () => route.Substring(4));
                return("#err-" + route.Substring(4));
            }

            var domainHelper = new DomainHelper(umbracoContext.Application.Services.DomainService);

            // extract domainUri and path
            // route is /<path> or <domainRootId>/<path>
            var pos       = route.IndexOf('/');
            var path      = pos == 0 ? route : route.Substring(pos);
            var domainUri = pos == 0
                ? null
                : domainHelper.DomainForNode(int.Parse(route.Substring(0, pos)), current);

            // assemble the url from domainUri (maybe null) and path
            return(AssembleUrl(domainUri, path, current, mode).ToString());
        }