http://user.qzone.qq.com/810087456/infocenter

ymecho

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  FileInfo DownloadFile = new FileInfo(FullFileName); //文件绝对路径
                if (DownloadFile.Exists)
                {
                    response.Clear();
                    response.ClearHeaders();
                    response.Buffer = false;
                    response.ContentType = "application/octet-stream";
                    response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.ASCII));
                    response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
                    response.WriteFile(DownloadFile.FullName);
                    response.Flush();
                  //  response.End();
}

 

posted on 2013-04-23 15:54  ymecho  阅读(145)  评论(0编辑  收藏  举报