Response.ContentType = "Put Your File ContentType Here";
Response.AddHeader("Content-Disposition", "attachment; filename=PutYourOldFileNameHere");
....
Response.AddHeader("Content-Disposition", "attachment; filename=PutYourOldFileNameHere");
....
我的意思是在界面中显示:文件名|后缀|链接
名单 doc //server/test/a/xxxxxxxxxxx.doc
程序 exe //server/test/a/sssssssssss.exe点击链接后,指向服务器上的文件链接。就像在web界面上查看邮件附件那样。
如果是word文件或图片直接显示就是了,如果是其他不能直接打开的文件就会弹出下载窗口,
那么如果将文件名换成表中的老文件名,而不是实际链接的文件名。
Response.AddHeader("Content-Disposition", "attachment; filename=PutYourOldFileNameHere");
下载链接使用download.aspx?id=XXX
然后在download.aspx里:
首先查询出相关文件名,
然后Response.AddHeader("Content-Disposition", "attachment;filename=XXX");,
再自己把文件读出来写到输出流上,
然后就等待成功吧。