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

推荐订阅源

量子位
S
Securelist
MyScale Blog
MyScale Blog
Jina AI
Jina AI
罗磊的独立博客
The Cloudflare Blog
美团技术团队
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
雷峰网
雷峰网
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
博客园 - 聂微东
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
T
Tailwind CSS Blog
Attack and Defense Labs
Attack and Defense Labs
博客园_首页
Latest news
Latest news
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Hacker News
The Hacker News
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
D
Docker
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
B
Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
V2EX - 技术
V2EX - 技术
N
News | PayPal Newsroom
Microsoft Security Blog
Microsoft Security Blog

博客园 - davidullua

Google chrome的离线安装版 百度进军B2C行业 File Comparer - To compare two files and check whether they have the same content No size set for variable length data type: String to create table if table do not exist -- to backup and restore table in oracle Gmail邀请 to call Session_End() event when user closed Browser When Session_End() and Session_Start() Fires about Ora-03114 disable asp.net connection pool(pooling) Oracle FAQ: 未在本地计算机上注册"OraOLEDB.Oracle"提供程序 (The 'OraOLEDB.Oracle' provider is not registered on the local machine) solution - davidullua ora-00054 , alter system kill session 'id,serial#' Change Path of C:\Documents and Settings - davidullua About FormsAuthentication.RedirectFromLoginPage(string username, bool createPersistentCookie) Send email by jmail or CDO according to configuration C#中调用控件的事件 [导入]C#向Sql Server中插入记录时单引号的处理 [导入]C#使用CDO发送邮件 [导入]使用jmail组件发送电子邮件(C#) [导入]C#中使用反射显示程序集的所有类型和属性 [导入]使用Oracle Developer Tools For Visual Studio .NET
Response.WriteFile()下载文件,打开对话框出现两次 - davidullua - 博客园
davidullua · 2005-09-24 · via 博客园 - davidullua

以如下的代码下载文件到客户端,客户点"打开",需要点两次
     HttpContext.Current.Response.Clear();

     //     //当要下载的文件名是中文时,需加上HttpUtility.UrlEncode
     //     HttpContext.Current.Response.ClearHeaders() ;
     //     HttpContext.Current.Response.ClearContent() ;
     HttpContext.Current.Response.AddHeader("Content-Disposition","attachment;filename=" + HttpUtility.UrlEncode(fi.Name));
     HttpContext.Current.Response.AddHeader("Content-Length",fi.Length.ToString());
     HttpContext.Current.Response.ContentType="application/octet-stream";
     HttpContext.Current.Response.WriteFile(fi.FullName,0,fi.Length);
     HttpContext.Current.Response.Flush();

解决方法,客户端设置文件类型:
1.打开我的电脑
2.工具=>文件夹选项
3.文件类型
4.选中一个文件类型,点"高级",取消勾选"下载后确认打开"
这样对于选定的文件类型,就不会打开两次了。

reference:
http://support.microsoft.com/default.aspx?scid=kb;en-us;303475