getsetcode getsetcode - 1 year ago 116
ASP.NET (C#) Question

How can I add support for SVG media files in Kentico when using Azure blob storage?

We have a Kentico instance which stores media files in Azure blob storage. When uploading images of type SVG it's storing them with the default content type "application/octet-stream". This means they're not displaying correctly in the browser. The fix would be to use the correct content type "image/svg+xml". Does anyone know if it's possible to force Kentico to use this content type for SVG files?

I realise this can be done after upload using Powershell but that's a technical step not appropriate to roll out to content editors.

Enn Enn
Answer Source

You can add your own mime types to ~/App_Data/mimetypes.txt file. I just checked the source code and "application/octet-stream" is used as a default value when the mime type for extension is not found here.

The other thing to do might be to set Disposition of the response. By default the SVG images will be treated as attachments in the HTTP headers which means most browsers will try to download it instead of displaying. It seems that you might be able to fix this by using your own list with inline attachments. Try adding this to your web.config:

<add key="CMSGetFileDispositionInlineExtensions" value="pdf;swf;swg" />

It would we awesome if you could let me know if that helped!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download