string filename = context.Request["fileName"].ToString();
string fileName = "【下载】" + filename;//客户端保存的文件名
string filePath = System.Web.HttpContext.Current.Request.MapPath("~/UpFile/TraceCode/" + filename + "");//路径
FileStream fileStream = new FileStream(filePath, FileMode.Open);
byte[] bytes = new byte[(int)fileStream.Length];
fileStream.Read(bytes, 0, bytes.Length);
fileStream.Close();
System.Web.HttpContext.Current.Response.ContentType = "application/octet-stream";
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
System.Web.HttpContext.Current.Response.BinaryWrite(bytes);
System.Web.HttpContext.Current.Response.Flush();
//System.Web.HttpContext.Current.Response.End();
//System.Web.HttpContext.Current.Response.Close();
System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest();