Hi there!
When it comes to serving files of unknown to UltiDev Cassini nature, Cassini has a couple of flaws going all the way back to original MS Cassini sample:
- One, is that it's impossible (in this version) to do what you are looking for - to assign a MIME type to a given file extension.
- Another is not generating caching headers that would eliminate of repeated downloads of content files.
To work around these issues, until they are fixed in the next release of Cassini, we recommend implementing a simple but efficient IHttpHandler and associating it with the file extension that is not served properly. This way you can take care of all the issues: speed, MIME type and caching.
To be concrete, here’s the outline of what you may want to do in order to implement the workaround.
- Start with creating an
IHttpHandler that will handle .FLV, .SWF and other file types of your choosing, instead of default Cassini logic.
- We will do our part and provide the
sample of the handler that will be very-very close to what you will want to do. The sample handler does serve files straight up, but also does the caching instructions. The only differences will be:
--- you will use request.MapPath() to find the physical location of the requested file, instead of UtilityMethods.GetPathByHash(),
--- content type will be “application/x-shockwave-flash” for .FLV and whichever one is right for the .SWF file. Other types corresponding to any other file extensions can be handled this way.
--- The “Content-Disposition” header won’t be necessary – using it may cause browser to prompt users to save the file.
- Please note that Returned304() methods used in the sample are
implemented here.
Please let us know if you were able to implement this handler and whether it has helped.
Best regards,
UltiDev Team.
Please donate at
http://www.ultidev.com/products/Donate.aspx to help us improve our products.