HTML页面代码
<a href="GetAttach.ashx?id=1">下载</a>
后台代码(.ashx一般处理程序)
//方法返回的就是byte[]类型的二进制流
Byte[] byt = websiteBO.GetDealDecision("1");
context.Response.ContentType = "application/msword";
context.Response.AddHeader("Content-Disposition", "attachment; filename=可以直接下载的word.doc");
context.Response.BinaryWrite(byt);`
效果就是用户点击链接时,直接下载。