I would like to handle requests differently depending upon the MIME type. For example, I have PDF\'s, images and other media files that I would like to prohibit access to ba
.NET's mime-type mappings are stored in the System.Web.MimeMapping
class which offers the GetMimeMapping method.
Prior to .NET 4.5, this class was marked as internal
, and thus not available to your code. In that case the best you can do is steal the list, which you can get using Reflector and decompile the static constructor (cctor).
If taking that approach, you may be better off simply creating a list of supported extensions and their mime type and storing it on a dictionary. (The list inside MimeMapping is a tad verbose)