Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
So, this works, but I'm still curious if this is storage-agnostic. Will this work for every possible storage provider?
var blob = media.BinaryData; using (var stream = blob.OpenRead()) { var reader = new StreamReader(stream); return reader.ReadToEnd(); }
We need to read media files. So, a text file is stored "for this page" or "for this block" and we need to read the contents of it from code.
I was doing this quite fine, but then I found out that my method (below) required the provider to be the local file system.
As soon as we deployed to Azure, this fell apart.
I have to assume there is a universal, storage-agnostic way of reading files from MediaData objects, but Google is polluted with code from several versions back. What's the latest, accepted way of doing this that will work no matter where a site is hosted?