public static string GetAbsolutePageUrl(Site site, string pageUrl) { FrontRequestChannel requestChannel = site.FrontRequestChannel(); string wrapperPageUrl = FrontUrlHelper.WrapperUrl(pageUrl, site, requestChannel).ToString(); string host = GetHost(site); return HttpContext.Current.Request.ToAbsoluteUrl(host, wrapperPageUrl); }
public static string GetAbsolutePageUrl(Site site, Page page, object values) { UrlHelper urlHelper = MvcUtility.GetUrlHelper(); FrontRequestChannel requestChannel = site.FrontRequestChannel(); string pageUrl = FrontUrlHelper.GeneratePageUrl(urlHelper, site, page, values, requestChannel).ToString(); string host = GetHost(site); return HttpContext.Current.Request.ToAbsoluteUrl(host, pageUrl); }
public static string GetHost(Site site) { FrontRequestChannel requestChannel = site.FrontRequestChannel(); if (requestChannel == FrontRequestChannel.Host || requestChannel == FrontRequestChannel.HostNPath) { return site.Domains.FirstOrDefault(o => !String.IsNullOrEmpty(o)) ?? HttpContext.Current.Request.Headers["Host"]; } else { return HttpContext.Current.Request.Headers["Host"]; } }