时间:2010-07-25 01:16:25

标签: c# asp.net ashx

2 个答案:

答案 0 :(得分:3)

答案 1 :(得分:1)

IE确实需要Mime类型。

以下我用于获取mime类型的图像,或强制它成为常规文件并让系统处理它。

objMIMEType = Microsoft.Win32.Registry.GetValue("HKEY_CLASSES_ROOT\\." + objAttachment.Extension, "Content Type", "application/octetstream");

        if (objMIMEType != null)
            strMIMEType = objMIMEType.ToString();
        else
        {
            strMIMEType = "application/octetstream";
            context.Response.AddHeader("Content-Disposition", "attachment; filename=" + objAttachment.FullFileName);
            context.Response.AddHeader("Content-Length", objAttachment.AttachmentData.Length.ToString());
        }
相关问题