asp.net 下载文件
//源文件名称
//提供下载的文件,不编码的话文件名会乱码
//private string fileName = HttpContext.Current.Server.UrlEncode("规范.rar");
string fileName = @"D:\我的文档\Visual Studio 2010\WebSites\WebSite14\a00.zip";
FileInfo info = new FileInfo(fileName);
long fileSize = info.Length;
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachement;filename=" + "您希望显示的文件名称.rar"); //这里的文件名称也应该编码
//指定文件大小
Response.AddHeader("Content-Length", fileSize.ToString());
Response.WriteFile(fileName, 0, fileSize);
Response.Flush();
Response.Close();