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

推荐订阅源

V
Visual Studio Blog
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
腾讯CDC
T
Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
美团技术团队
Cisco Talos Blog
Cisco Talos Blog
C
Cisco Blogs
A
Arctic Wolf
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
爱范儿
爱范儿
GbyAI
GbyAI
The Register - Security
The Register - Security
AWS News Blog
AWS News Blog
MyScale Blog
MyScale Blog
T
Tenable Blog
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
Cyberwarzone
Cyberwarzone
量子位
Microsoft Azure Blog
Microsoft Azure Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
C
Cybersecurity and Infrastructure Security Agency CISA
The Cloudflare Blog
B
Blog RSS Feed
小众软件
小众软件
D
Docker
Know Your Adversary
Know Your Adversary
Y
Y Combinator Blog
P
Privacy & Cybersecurity Law Blog
Engineering at Meta
Engineering at Meta
Latest news
Latest news
AI
AI
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
S
Secure Thoughts
N
News | PayPal Newsroom
The Hacker News
The Hacker News
MongoDB | Blog
MongoDB | Blog
Martin Fowler
Martin Fowler
博客园 - 司徒正美
L
Lohrmann on Cybersecurity
Cloudbric
Cloudbric

博客园 - 熵星尘

苦逼的程序员都是这么玩游戏的(微信:天天连萌) 关于ASP.NET动态加载控件的几点实用总结 记录代码运行耗时的写法 关于Linq to DataTable not in的写法 DevExpress AspxGridView数据绑定 发现一个Membership的bug 无法将类型为“Oracle.DataAccess.Types.OracleString”的对象强制转换为类型“System.String”。 gridview 的添加删除等技巧 全部按名称取值 【部分转】innerText 跟 innerHTML区别 asp.net验证组件membership登录失败的问题 母板页中的引用的图片,JS,css等路径问题 - 熵星尘 - 博客园 如何获取GridView的EmptyDataTemplate中的控件 Mutex实现单实例,你真的搞懂了吗?来看看吧。 VS2008 如何在WinForm中显示flash - 熵星尘 - 博客园 【原创】从图像转换到byte[]数组的几种方法 除夕晚的一帖:如何为repeater内部控件设置javascript,如何取得它们的客户端ID。 回发或回调参数无效。 问题的解决和思考 - 熵星尘 - 博客园 【作品发布】正式发布Tuff的神奇小软盘1.2 【作品发布】QQ2008远程自助 1.5.1.1
asp.net页面中文件下载的2种方式 - 熵星尘 - 博客园
熵星尘 · 2009-12-27 · via 博客园 - 熵星尘

//Write pdf bytes to outputstream
        // 在线打开
        if (DKFS == "pdf")
        {
            Response.ContentType = "application/pdf";
        }
        // 下载
        if (DKFS == "octet-stream")
        {
            Response.AddHeader("Content-Disposition", string.Format("attachment;Filename={0}.pdf", Server.UrlEncode(string.Format("租赁意见书({0})", CZRXM))));
        }

通常使用:Response.BinaryWrite(m.ToArray());//m是MemoryStream

记得最后加上

   Response.OutputStream.Flush();
        Response.OutputStream.Close();
        Response.End();// 很多文章都没有这一句,但是非常重要,我不加就会在post出来的文件末尾加上当前页面代码...好杯具