日期:2009-12-31 浏览次数:20492 次
- //读取文件输出它
- string strFile = "c://abc.doc";
- FileStream fs = new FileStream(strFile, FileMode.Open);
- byte[] bytes = new byte[(int)fs.Length];
- fs.Read(bytes, 0, bytes.Length);
- fs.Close();
- Response.ContentType = "application/octet-stream";
- Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(File.Name));
- Response.BinaryWrite(bytes);
- Response.End();