public PermanentLinkMap Find(EPiServer.UrlBuilder url)
        {
            var noLang = new UrlBuilder(url);

            noLang.QueryCollection.Remove("epslanguage");
            return(_linkMaps.SingleOrDefault(map => map.MappedUrl == noLang.Uri || map.PermanentLinkUrl == noLang.Uri));
        }
 public bool TryToPermanent(string url, out string permanentUrl)
 {
     permanentUrl = null;
     var urlBuilder = new EPiServer.UrlBuilder(url);
     var plm = Find(urlBuilder);
     if (plm != null)
     {
         permanentUrl = MergeQueryParams(plm.PermanentLinkUrl, urlBuilder, false);
         return true;
     }
     return false;
 }
        public bool TryToPermanent(string url, out string permanentUrl)
        {
            permanentUrl = null;
            var urlBuilder = new EPiServer.UrlBuilder(url);
            var plm        = Find(urlBuilder);

            if (plm != null)
            {
                permanentUrl = MergeQueryParams(plm.PermanentLinkUrl, urlBuilder, false);
                return(true);
            }
            return(false);
        }
示例#4
0
 public static string GetFriendlyUrl(this HtmlHelper helper, LinkItem linkItem)
 {
     EPiServer.UrlBuilder url = new EPiServer.UrlBuilder(linkItem.GetMappedHref());
     EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, linkItem.GetMappedHref(), System.Text.UTF8Encoding.UTF8);
     return url.ToString();
 }