All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
ASP.NET文件下载实现方法源程序_[Asp.Net教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/1/30 1:22:14 Browse times: 336 Comment times: 0

ASP.NET文件下载实现方法源程序_[Asp.Net教程]


Head photo

Go homepage
Upload pictures
Write articles

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);




There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.