I am having issues when trying to get the PageMeta
from the page directly. Below is my sample code. Can you please advice me if I am doing it wrong?
Error Message: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at
IPageMeta pageMeta = (IPageMeta)result[0];
/*
Use PageMetaFactory and retrieve the metadata of the page located at
/us/potential-at-work/application-leaders/article.aspx
*/
string pubID = "tcm:0-12-1";
string url = HttpContext.Current.Request.Url.AbsoluteUri;
PageMetaFactory pageMetaFactory = new PageMetaFactory(pubID);
IList result = pageMetaFactory.GetMetaByUrl(url);
IPageMeta pageMeta = (IPageMeta)result[0];