Custom MIME Types in file.axd?

Topics: ASP.NET 2.0, Business Logic Layer
Jun 4, 2008 at 6:21 PM
Edited Jun 4, 2008 at 6:37 PM
We have ran into a problem while posting podcasts where iTunes (possibly other RSS readers) does not see the podcast file because the mime type returned by file.axd is "application/octet-stream" and iTunes is looking for "audio/mpeg" for an audio podcast... BTW: we're filtering it through feedburner to get the tags in our RSS needed for iTunes (a great extension idea or rewrite of syndication.axd code) and per info on feedburner's website the mime type is derived directly from the server.

Is there a easy way to override file.axd the "Content-Type:" header (mime type) returned with the file based on file's extension?
Other suggestions?

Thanks in advance!

Jun 4, 2008 at 8:03 PM
Is this what you are trying to do?
Jun 4, 2008 at 11:43 PM
rtur - yes, by the looks of it you have already taken care of this. Does that mean all I have to get the latest BlogEnge.Core and re compile to get this feature?


PS: I'm already a fan of your mp3 player extension... I've used that player for years and just love it, I'm glad you ported it over.
Jun 5, 2008 at 3:30 AM
Yes, it's been in the code base for a few months now. Latest Core won't work with 1.3 web though, and there are some stuff in admin pages to turn enclosure on/off - you'll need to upgrade the whole project. Not necessarily to the very latest, and up will do and should be no problem to upgrade from 1.3.
Thanks for the kind words :)
Jun 6, 2008 at 2:36 AM
rtur - I may need some more help here... so I've updated to and the update process went somewhat smooth, I enabled enclosures in the Settings per your instructions but I'm still having trouble getting iTunes to see my audio links only direct links to an acual mp3 files work.

to clarify I'm using the file upload function and then re-using the /file.axd?file=mypodcastfile.mp3 link that gets generated, the mp3 player and a separate "Download" link on the post work perfect, however when viewing the syndication.axd the enclosure link that replaces the player has the root of the site 2-times in the link .... ie: http://localhost/mysite/blog/mysite/blog/file.axd?file.axd?file=mypodcastfile.mp3

Have you encountered this? If so where would be a good place to look for a fix?... even when I made sure that the path (manually) was matching the the actual path that returned a file, iTunes still doesn't see it... is this an .axd curse?

Also in your example I saw that you have a setting "Media storage location" above "Enable Enclosures"... I'm not seeing that--could it be I screwed up the installation?

Thank you in advance.
Jun 6, 2008 at 3:26 PM
Try to disable ResolveLinks extension and see if it will help.  I've ran into similar problem with images and had to modify this extension to fix it. Don't worry about media location, it was removed and you can store files anywhere within application directory.
Jun 6, 2008 at 10:19 PM
rtur - thanks for all your help, I've got it working now :-)

I did have to modify Add_Entry.cs admin page to upload .mp3 files to /audio directory and automatically insert the mp3player + "Download" link in the post... default upload location within App_Code using file.axd just didn't work for me... but a direct link to .../audio/mypodcast.mp3 works perfect.