会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
滨_Notepad
学习工作点滴积累
博客园
::
首页
::
新随笔
::
联系
::
订阅
::
管理
公告
.net 下实现下载
Posted on
2007-12-11 21:17
新人~
阅读(
172
) 评论(
0
)
编辑
收藏
举报
System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath("~/upFile/abc.rar")); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(file.Name));
System.IO.FileInfo file
=
new
System.IO.FileInfo(Server.MapPath(
"
~/upFile/abc.rar
"
));
Response.Clear();
Response.AddHeader(
"
Content-Disposition
"
,
"
attachment; filename=
"
+
HttpUtility.UrlEncode(file.Name));
Response.AddHeader(
"
Content-Length
"
, file.Length.ToString());
Response.ContentType
=
"
application/octet-stream
"
;
Response.WriteFile(file.FullName);
Response.End();
把fileInfo的参数改为数据库中读出来的下载路径即可
会员力量,点亮园子希望
刷新页面
返回顶部
Powered by:
博客园
Copyright © 2024 新人~
Powered by .NET 8.0 on Kubernetes