是不适应该改这个Response.ContentType = "application/octet-stream";

解决方案 »

  1.   

    浏览器是靠文件的扩展名来识别文件类型的;即这句
    Response.AddHeader("Content-Disposition", "attachment; filename=" + filename );中filename中的文件扩展名。
      

  2.   

    在大家的帮助下做出来了,分享一下
    主要是下载的if (dr.Read())
            {   
                string km = dr["附件类型"].ToString().Trim();
                string name = "TEXT" +"."+ km;
                byte[] barrImage = (byte[])dr["附件"];
                System.IO.MemoryStream ms = new System.IO.MemoryStream(barrImage);
                Response.ClearContent();
                Response.ContentEncoding = System.Text.Encoding.UTF8;
                // 添加 信息, "文件下 /另存 "  框指定默 文件名
                Response.AddHeader("Content-Disposition", "attachment; filename=" +name );
                // 添加 信息,指定文件大小,   器能  示下  度
                Response.AddHeader("Content-Length", barrImage.Length.ToString());
                Response.ContentType = "application/octet-stream";
                Response.BinaryWrite(ms.ToArray());
                Response.End();
            }
            dr.Close();
            strConn.Close();