Try our conversational search powered by Generative AI!

Serving Blobs in CustomFileHandler

Vote:
 

Hi, there,

I need to do some extra processing on a media type. I am following the code sample provided on this page.

http://world.episerver.com/documentation/items/developers-guide/episerver-cms/75/content/assets-and-media/media-types-and-templates/

I have confirmed that the handler gets called when that media type is called. The issue is that it is not returning the pdf file.

So I have two questions. First, is there a method that the framework provides to serve blobs?

And the second question. In case there is no method to server blobs, is there a method to turn blobs into a Binary Stream?

Thanks in advance.

#140524
Oct 21, 2015 23:34
Vote:
 

I have the same problem. Did you solve this problem?

Best Regards

Anders

#149571
Jun 03, 2016 14:54
Vote:
 

Hi Anders (and Hugo).

We've previously done numourous implementations relying on a custom HttpHandler for Media in Episerver. It has e.g. been used for tracking downloads and enforcing access control for first download (kind of a gated approach to documents).

I've shared some of the important code from our implementation as a Gist on Github. I hope that can help you move forward. Be aware that it has been taken out a bigger context.

https://gist.github.com/casper-rasmussen/8ba5a1135fadc79a87b9d53cc409fc5a

Casper Aagaard Rasmussen

#149577
Jun 03, 2016 17:18
Vote:
 

Hi Casper,

Thank you very much. We changed some code in your example and now everything is working as we like :)

Best Regards

#149765
Jun 07, 2016 13:37
* 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.