簡體   English   中英

得到文本文件的啞劇

[英]getting the mime of text files

我正在使用有人粘貼到使用urlmon.dll的C#的一段代碼。 它讀取<= 256bytes,並根據數據返回啞劇。

問題是它無法將CSS文件與文本/純文本區分開。 我可以轉到/style.css,但是將其包含在html中時,CSS不會顯示。 我正在使用urlmon + context.Response.TransmitFile發送它。

嗯,我不確定我是否完全理解您的問題,但是如果您想根據主列表進行某種查找,則可以查看IIS元數據庫

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM