惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - SysInfo

[转]一个利用Sql Server 20005的 ROW_NUMBER Function 的分页存储过程. 新域名注册成功.http://sysinfo.com.cn/ 如何在上传图片之前预览图片? - SysInfo - 博客园 asp.net执行.sql文件 - SysInfo - 博客园 The New Controls of ASP.NET 2.0 Installing the ASP.NET "Atlas" Wiki - SysInfo [转]常见的 Web 项目转换问题及解决方案 今天下午回家:提前给大家拜个年! [转]MSN消息提示类(纯js编写) - SysInfo - 博客园 window对象的status、location、name、self、opener属性的使用 RadioButton加入DataGrid模板列引起的问题。 疙瘩汤 NHibernate 细说HTML元素的ID和Name属性的区别 收藏 用JavaScript解决ASP.NET服务器控件造成的刷新问题 为.net中的ListBox控件添加双击事件 子父窗口之间的操作之小例子 用实例说明如何用JavaScript生成XML
Response.BinaryWrite()下载时文件名的问题.
SysInfo · 2005-11-24 · via 博客园 - SysInfo

我们经常将文件上传到数据库中,比如Sql Server中.
然后在下载的时候,用的比较多的也就是Response.BinaryWrite()方法,然而如果直接输出的话,其文件名总是为你的页面的文件名,如downLoadFile.aspx.
其解决方法为:

 1 Page.Response.Buffer=true;  
 2 Page.Response.Clear();  
 3 //这里的ContentType也可以读存入数据库中的文件类型.
 4 Page.Response.ContentType="Application/unknown";  
 5 //attachment是以附件的形式下载,也可以改为online在线找开.
 6 Response.AddHeader("Content-Disposition","attachment;  filename="  +  
 7                                                              ds.Tables[0].Rows[0]["filename"].ToString()  +  ";");  
 8            
 9 Page.Response.BinaryWrite(file);  
10 Page.Response.Flush();  
11 Page.Response.End();