//呼叫方法
DownloadFile("aa.doc", System.IO.File.ReadAllBytes(context.Server.MapPath("/temp/aa.doc")));
private void DownloadFile(string FileNameWhenUserDownload, byte[] FileContent)
{
Response.ClearHeaders();
Response.Clear();
Response.Expires = 0;
Response.Buffer = true;
Response.AddHeader("Accept-Language", "zh-tw");
Response.AddHeader("content-disposition", "attachment; filename=" + FileNameWhenUserDownload);
Response.ContentType = "Application/msword";
Response.BinaryWrite(FileBody);
Response.End();
}
沒有留言:
張貼留言