Does Sitecore (7.2+) have something like Sitecore.Links.LinkManager.GetDefaultUrlOptions() except for media URLs?

We have a library of extension methods off of Item to make things easier and it looks like when that was created over a year ago I ended up just using new Sitecore.Resources.Media.MediaUrlOptions().

My searches aren't turning up anything, so I'd like to know if I'm just missing something or if that's the solution.


1 Answer 1


No, there is not.

mediaProvider definition in Sitecore is limited to

<mediaProvider type="Sitecore.Resources.Media.MediaProvider, Sitecore.Kernel" />

while LinkProvider definition contains lot of properties which are used as default options:

<add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="asNeeded" languageLocation="filePath" lowercaseUrls="false" shortenUrls="true" useDisplayName="false" />

That's why Sitecore uses MediaUrlOptions.Empty when options are not specified:

public virtual string GetMediaUrl(MediaItem item)
  return this.GetMediaUrl(item, MediaUrlOptions.Empty);

public virtual string GetMediaUrl(MediaItem item, MediaUrlOptions options)

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.