Answer by CShark for File extensions and MIME Types in .NET
I would just like to caution you against retrieving the Mime / content type of a file without validating it against the actual content of the file, as it could pose a serious security risk to your...
View ArticleAnswer by Chris S for File extensions and MIME Types in .NET
The System.Web.MimeMapping has 3 versions - two version 4.0s (where one of these is internal), and then a version 2.0 which is also internal. As pointed out, there is a public version of the class in...
View ArticleAnswer by Cymen for File extensions and MIME Types in .NET
I've written a program to fetch and convert the Apache mime.types file to a C# Dictionary<string, string> keyed by file extension. It's here:https://github.com/cymen/ApacheMimeTypesToDotNetThe...
View ArticleAnswer by SkyMoon for File extensions and MIME Types in .NET
I also found that the Init() method would be called and the _extensions and _mime members would not be completely initialized so I changed it to read, and the best way is, remove call GetExtension in...
View ArticleAnswer by Toby for File extensions and MIME Types in .NET
Nisus - would you be willing to post the entire source code for your utility somewhere? that would really be helpful. thanks!Never mind....I edited the apache definition file to only contain entries...
View ArticleAnswer by Nisus for File extensions and MIME Types in .NET
I have combined all these approaches in my utility lib, except maybe no.3.Btw, no.2 (urlmon.dll) doesn't require static file, it simply takes some bytes no matter where they had come from.Here's my...
View ArticleAnswer by Lucero for File extensions and MIME Types in .NET
It depends what you need the MIME type for. In general, for services (web apps, web service, etc.), it's advisable not to use a MIME list which is dependent on the OS settings, or only as fallback if...
View ArticleFile extensions and MIME Types in .NET
I want to get a MIME Content-Type from a given extension (preferably without accessing the physical file). I have seen some questions about this and the methods described to perform this can be resumed...
View Article