/// <summary> /// Looks for a friendly URL and set pageUrl if found. /// </summary> /// <param name="relativeUrl">The string to match to a friendly URL</param> /// <param name="pageUrl">The matching page, if a match was found. Otherwise null.</param> /// <returns>True if a friendly URL match was found</returns> public static bool TryParseFriendlyUrl(string relativeUrl, out PageUrl pageUrl) { UrlKind urlKind; PageUrlData pageUrlData = PageUrls.ParseUrl(relativeUrl, new UrlSpace(), out urlKind); if (pageUrlData == null || urlKind != UrlKind.Friendly) { pageUrl = null; return(false); } pageUrl = new PageUrl(pageUrlData.PublicationScope, pageUrlData.LocalizationScope, pageUrlData.PageId, PageUrlType.Friendly); return(true); }
/// <summary> /// Looks for a friendly URL and set pageUrl if found. /// </summary> /// <param name="relativeUrl">The string to match to a friendly URL</param> /// <param name="pageUrl">The matching page, if a match was found. Otherwise null.</param> /// <returns>True if a friendly URL match was found</returns> public static bool TryParseFriendlyUrl(string relativeUrl, out PageUrl pageUrl) { UrlKind urlKind; PageUrlData pageUrlData = PageUrls.ParseUrl(relativeUrl, new UrlSpace(), out urlKind); if (pageUrlData == null || urlKind != UrlKind.Friendly) { pageUrl = null; return false; } pageUrl = new PageUrl(pageUrlData.PublicationScope, pageUrlData.LocalizationScope, pageUrlData.PageId, PageUrlType.Friendly); return true; }