SaaS CMS has officially launched! Learn more now.

Get blob's "raw" URL on disk


Hey Guys,

i have a property on my blocktype called Image of type URL. I'm using EPiServer CMS 8 btw and i'm a bit new to EPiServer.

        public virtual Url Image { get; set; }

Now when i select my image on the block, and in my view i dont want the friendly url to the image, but i want to have the raw url (with the {guid}/{guid}.png ) on disk.

How can i retrieve that?

Because my images are being cropped by a IIS web i use on another domain. So i need the url on disk for the blob (media).


Gives me something like /link/19130d49edd84c2483d6c44169fc1e5e.aspx but i want


Apr 14, 2015 13:22


First you need to retrieve the MediaData item and then check if the blob is actually stored on disk (FileBlob). Something like this:

var media = UrlResolver.Current.Route(new UrlBuilder(Image)) as MediaData;

if (media != null)
    var fileBlob = media.BinaryData as FileBlob;

    if (fileBlob != null)
        var path = fileBlob.FilePath;

You could also change your Image from Url to ContentReference, then you don't need to use the UrlResolver and makes it easier for the editor to select an image.

Apr 14, 2015 19:44

Thanks alot.. this did the trick... i also switched back to ContentReference for the Image property.

Apr 16, 2015 13:06
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.