views:

113

answers:

1

I am using a piece of code someone pasted for C# which uses urlmon.dll. It reads in <= 256bytes and returns the mime based on the data.

Problem is it cant distinguishes a css file from a text/plain. I can goto /style.css but when including it in my html the CSS does not show up. I am using urlmon + context.Response.TransmitFile to send it.

+1  A: 

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
    }
 }
Bob