你试试这个
<%@ page contentType="application/msword;charset=utf8" %>
<% response.setHeader("Content-disposition","inline; filename=test1.doc"); %>
支持楼上,加个头就行
DataTable dt=appendix.GetOneAppendix(FatherProjectCode, InsertDate, Convert.ToInt32(AccessoriesID));
Byte[] mydate = (Byte[])dt.Rows[0]["Context"];
string fileName = dt.Rows[0]["AccessoriesName"].ToString().Trim().Replace("-", "").Replace(" ", "") + "." + dt.Rows[0]["Postfix"].ToString().Trim().Replace("-", "").Replace(" ", "");
Response.AddHeader("Content-Length", mydate.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName));
Response.ContentType = "application/octet-stream";
Response.OutputStream.Write(mydate, 0, mydate.Length);
Response.End();
这是我以前写的,收集下来了
问题解决了没?兄弟 。我也遇到这个问题。求助!