rar压缩文件下载

 //string fileName = "ceshi.rar";//客户端保存的文件名         //string filePath = Server.MapPath("keji.rar");//路径         //路径         string filePath = Server.MapPath("~/DownLoadFileTemp/" + this.FileUrl.Text);         string fileName = this.FileUrl.Text;

        FileInfo fileInfo = new FileInfo(filePath);         Response.Clear();         Response.ClearContent();         Response.ClearHeaders();         Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);         Response.AddHeader("Content-Length", fileInfo.Length.ToString());         Response.AddHeader("Content-Transfer-Encoding", "binary");         Response.ContentType = "application/octet-stream";         Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");         Response.WriteFile(fileInfo.FullName);         Response.Flush();         Response.End();

posted @ 2016-04-18 17:04  Carri  阅读(179)  评论(0编辑  收藏  举报