It's an Web API project, to provide some data for third parties.

var image = new MediaItem(imageField.MediaItem);
string src = Sitecore.StringUtil.EnsurePrefix('/', Sitecore.Resources.Media.MediaManager.GetMediaUrl(image));

This only get a relative url like "/en/-/media/myrestaurant/home-image-carousel-1.jpg"

How can I get the full path of this iamge? something like GetFriendlyUrl() for a general link which I can get a full path of it as https://local.xxrestaurant:443/en/about-us ?

1 Answer 1


you have to use MediaUrlOptions and to pass it to GetMediaUrl method.

You will have:

            var image = new MediaItem(imageField.MediaItem);
            MediaUrlOptions mediaUrlOptions = new MediaUrlOptions();
            mediaUrlOptions.AlwaysIncludeServerUrl = true;
            string src = Sitecore.StringUtil.EnsurePrefix('/', Sitecore.Resources.Media.MediaManager.GetMediaUrl(image,mediaUrlOptions));
  • Thanks, that really helps.
    – wtf512
    Commented May 8, 2020 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.