日期:2014-05-17 浏览次数:20420 次
string fileName = filename; string filePath = Server.MapPath(ResolveUrl("~/DataBackUp/")) + filename;//路径 FileStream fs = new FileStream(filePath, 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=" +fileName); Response.BinaryWrite(bytes); Response.Flush(); Response.End();