Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)归海一刀
published in(发表于) 2014/1/30 1:22:14
ASP.NET文件下载实现方法源程序_[Asp.Net教程]

ASP.NET文件下载实现方法源程序_[Asp.Net教程]
private void FileDownload(string FullFileName)

{

FileInfo DownloadFile = new FileInfo(FullFileName);
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.UTF8));

Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());

Response.WriteFile(DownloadFile.FullName);

Response.Flush();

Response.End();

}
调用方法

string path= Server.MapPath("fujian/"+文件名称);
//path为服务器存放文件的路径
FileDownload(path);


If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759