Question

I was using urlmon to find the MIME of files however it didnt go well when i couldn't get the correct mime of css files and more SWFs. What can i use to get the file mime?

Was it helpful?

Solution

Hmm, I am not sure I completely understand your question, but if you want to do some sort of look up against a master list you can look at the IIS Metabase

using (DirectoryEntry directory = new DirectoryEntry("IIS://Localhost/MimeMap")) {
    PropertyValueCollection mimeMap = directory.Properties["MimeMap"];
    foreach (object Value in mimeMap) {
        IISOle.MimeMap mimetype = (IISOle.MimeMap)Value;
        //use mimetype.Extension and mimetype.MimeType to determine 
        //if it matches the type you are looking for
    }
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top