/**/ /// <summary> /// 下载文件 /// </summary> /// <param name="path">文件所在的物理路径</param> /// <param name="fileName">文件名称</param> /// <param name="contentType">客户端MIME类型</param> private void UpLoadFile( string path, string fileName, string contentType) { FileInfo fi = new FileInfo(path); FileStream fs = fi.OpenRead(); byte[] FileArray = new byte[(int)fs.Length]; fs.Read(FileArray, 0, FileArray.Length); fs.Close(); Response.Buffer = true; Response.Clear(); Response.ContentType = contentType; Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName); Response.BinaryWrite(FileArray); Response.Flush(); Response.End(); }