给个例子你
public static void filedown(string fileid)//文件下载
{
HttpResponse clsreponse=System.Web.HttpContext.Current.Response;
SqlDataReader qq;
qq=Sqlop.ExecuteReader("SELECT fileName, fileContext FROM CRDFILE WHERE fileid='" +fileid+"'");
if (qq.Read())
{
clsreponse.ClearHeaders();
clsreponse.ClearContent();
clsreponse.AddHeader("Content-Disposition", "attachment; filename=" + qq["fileName"].ToString().Trim());
Byte[] context =(Byte[])qq["fileContext"];
clsreponse.OutputStream.Write(context, 0, context.Length);
clsreponse.End();
}
else
{
basefun.alt_sun("No file found!");
}
qq.Close();
}

解决方案 »

  1.   

    这样
    Response.AddHeader("Content-Disposition", "attachment; filename=" + m_Dtl.Rows[0]["AttachmentSourceName"].ToString());

    Response.Charset = "UTF-8";
    Response.ContentType=m_Dtl.Rows[0]["AttachmentContentType"].ToString();
    Response.BinaryWrite((byte[])m_Dtl.Rows[0]["AttachmentContent"]);其中
    ContentType = FileNew.PostedFile.ContentType;                          
    表示附件的MIME类型
      

  2.   

    to davixiong(Minbear) 
    不行呀,还是有提示保存的对话框呀
      

  3.   

    使用com组件。
    因为下载到客户端好办。上载有一定难度
      

  4.   

    如果出现下载对话框,说明你的Word的MIME类型在IIS里面没有设置,自己手动设置,或者保存的时候同时保存上传文件的ContentType(MIME类型)
    Response.ContentType