/// <summary> /// Maps to HTTP page. /// </summary> /// <param name="pageMetatag">The page metatag.</param> /// <param name="page">The page.</param> /// <param name="forceMapping">if set to <c>true</c> [force mapping].</param> public static void MapToHttpPage(this IHttpPageMetatag pageMetatag, HttpPage page, bool forceMapping) { if (pageMetatag == null) throw new ArgumentNullException("metatag"); if (page == null) throw new ArgumentNullException("page"); var pageHead = page.Head; if (pageHead == null) throw new NullReferenceException("page.Head"); // string text; if (!string.IsNullOrEmpty(text = pageMetatag.Description) || forceMapping) pageHead.Description = text; if (!string.IsNullOrEmpty(text = pageMetatag.Keywords) || forceMapping) pageHead.Keywords = text; if (!string.IsNullOrEmpty(text = pageMetatag.Title) || forceMapping) pageHead.Title = text; if (!string.IsNullOrEmpty(text = pageMetatag.Tag) || forceMapping) pageHead.Tag = text; }
/// <summary> /// Maps to HTTP page. /// </summary> /// <param name="pageMetatag">The page metatag.</param> /// <param name="page">The page.</param> public static void MapToHttpPage(this IHttpPageMetatag pageMetatag, HttpPage page) { MapToHttpPage(pageMetatag, page, false); }