ASP.NET
使用ASP.NET 如何实现下载功能?? --------------------编程问答-------------------- DS ds = new Facade().GetData(attachID);
DS.AttachRow attach = ds.Attach[0];
context.Response.Expires = 0;
context.Response.Buffer = true;
context.Response.AddHeader("Accept-Language", "zh-cn");
context.Response.AddHeader("content-disposition", "attachment; filename=" + HttpUtility.UrlEncode(attach.FileName, System.Text.Encoding.UTF8));
context.Response.ContentType = "Application/octet-stream";
context.Response.BinaryWrite(attach.Content);
context.Response.End(); --------------------编程问答--------------------
string FullFileName = "D:\\work\\gaj123\\GAJWZ\\uploads\\20096895548123.mht";//假设路径
if (!File.Exists(FullFileName))
{
Response.Write("<Script Language=JavaScript>alert(\"文件不存在!\")</Script>");
return;
}
FileInfo DownloadFile = new FileInfo(FulolFileName);
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();
这样写的话如果用迅雷下载的话 下载的是.aspx页面 其他正常 借个地方问下有什么解决方法 --------------------编程问答-------------------- 让迅雷开发组修改一下
补充:.NET技术 , ASP.NET