韩言福地

只有想不到的,没有办不到的。 - HY Auspicious Place

« asp.net 不同的 文件下载 方法. 数据流文件下载 糊涂过了一个星期 »

读取数据库存放的二进制文件

        if (dr.Read())
        {
            object oa = dr["FileInfo"];
            Byte[] fileinfo = (byte[])oa;
            Response.AddHeader("Connection", "Keep-Alive");
            this.Response.ContentType = dr["ContentType"].ToString();
            Response.AddHeader("Content-Disposition", "attachment;filename=" +dr["FileName"].ToString());
            Response.AddHeader("Content-Length", fileinfo.Length.ToString());

            this.Response.BinaryWrite(fileinfo);
           
            dr.Close();
            this.Response.End();
        }

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Copyright 2007-2010 www.yinrg.com(HY Auspicious Place) . 湘ICP备06007796号.