怎样输出 图片 下载?

ASP.NET可以直接输出文件下载,例如doc,zip,rar这类IIS不能解释的格式,如果是Bmp,Gif,Jepg就不行了,怎样实现其下载呢(出现保存那个对话框)?

    // Identify the file to download including its path.
    string filepath = DownloadFileName;

    
// Identify the file name.
    string filename = System.IO.Path.GetFileName(filepath);

    Response.Clear();

    
// Specify the Type of the downloadable file.
    Response.ContentType = "application/octet-stream";

    
// Set the Default file name in the FileDownload dialog box.
    Response.AddHeader("Content-Disposition""attachment; filename=" + filename);

    Response.Flush();

    
// Download the file.
    Response.WriteFile(filepath);

看了http://www.cnblogs.com/koffer/archive/2004/10/14/52289.htmlt也没有发现答案! 

BTW:Response.WriteFile 无法下载大文件
原文地址:https://www.cnblogs.com/caca/p/224565.html