Try our conversational search powered by Generative AI!

Get absoulte URL of ContentReference



How to get the absolute URL of the content reference ?

            Name = "xxx",
            Description = "xxx",
            GroupName = xx,
            Order = 350)]
        public virtual ContentReference TestImage { get; set; }

//I found that this method works, is there any better method ?
 return UrlResolver.Current.GetUrl(pageHelper.GetCurrentPageData().MetaImage, null,
                    new VirtualPathArguments { ForceAbsolute = true });

Aug 24, 2023 7:26
Vincent - Aug 24, 2023 12:41
I think this is the correct way and from memory Optimizely cms generate absolute url using the same way

Looks fine. I use: UrlResolver.Current.GetUrl(contentReference, null, new VirtualPathArguments { ForceAbsolute = true });

In a muliti-language solution you might want to include the language, ContentLanguage.PreferredCulture.Name, or the language of the actual page.

Aug 24, 2023 9:00
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.