Tuesday, June 24, 2014

Extension Randomly Added in Sitecore Media Item URLs

In Sitecore 6.6, MediaManager randomly adds extension while generating URL for any Sitecore Media Item. This is a bug in Sitecore. A workaround is available to fix this issue.
MediaUrlOptions mediaUrlOpts = new MediaUrlOptions();
mediaUrlOpts.IncludeExtension = false;
Response.Write(MediaManager.GetMediaUrl(item, mediaUrlOpts));

In case extension is always needed in the URL then set IncludeExtension property to true.

No comments:

Post a Comment