示例#1
0
 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);
 }
示例#2
0
 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);
 }
示例#3
0
 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"];
     }
 }